-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path10474.cpp
More file actions
52 lines (49 loc) · 1.57 KB
/
Copy path10474.cpp
File metadata and controls
52 lines (49 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Author: btjanaka (Bryon Tjanaka)
// Problem: (UVa) 10474
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORe(i, a, b) for (int i = a; i <= b; ++i)
#define PAI(arr, len) /*Print array of integers*/ \
{ \
for (int _i = 0; _i < len; ++_i) { \
if (_i != len - 1) { \
printf("%d ", arr[_i]); \
} else { \
printf("%d", arr[_i]); \
} \
} \
putchar('\n'); \
}
#define PBS(n, len) /*Print a bitset*/ \
{ \
for (int _i = 0; _i < len; ++_i) { \
putchar(n % 2 + '0'); \
n /= 2; \
} \
putchar('\n'); \
}
#define GET(x) scanf("%d", &x)
#define PLN putchar('\n')
#define INF 2147483647
typedef long long ll;
using namespace std;
int nums[12000];
int main() {
int n, q;
for (int ca = 1; GET(n) && GET(q) && n && q; ++ca) {
printf("CASE# %d:\n", ca);
FOR(i, 0, n) GET(nums[i]);
sort(nums, nums + n);
int qu;
FOR(i, 0, q) {
GET(qu);
int* found = lower_bound(nums, nums + n, qu);
if (found != nums + n && *found == qu) {
printf("%d found at %d\n", qu, int(found - nums + 1));
} else {
printf("%d not found\n", qu);
}
}
}
return 0;
}