Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <vector>
- using namespace std;
- int main()
- {
- vector<int> a;
- int x, n, q, k = 1;
- while (true) {
- scanf("%d%d", &n, &q);
- if (n == 0 && q == 0) {
- break;
- }
- a.assign(10001, 0);
- for (int i = 0; i < n; i++) {
- scanf("%d", &x);
- a[x]++;
- }
- int num = 1;
- for (int i = 0; i <= 10000; i++) {
- if (a[i] > 0) {
- x = num + a[i];
- a[i] = num;
- num = x;
- }
- }
- printf("CASE# %d:\n", k++);
- for (int i = 0; i < q; i++) {
- scanf("%d", &x);
- if (a[x] == 0) {
- printf("%d not found\n", x);
- } else {
- printf("%d found at %d\n", x, a[x]);
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement