# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
27404 | 2017-07-12T12:19:46 Z | undecember | 사냥꾼 (KOI13_hunter) | C++14 | 89 ms | 2392 KB |
#include <bits/stdc++.h> using namespace std; int m, n, l; vector<int> shr; int main(void) { int n; scanf("%d%d%d", &m, &n, &l); shr.assign(m, 0); int i; for (int i = 0; i < m; i++) scanf("%d", &shr[i]); sort(shr.begin(), shr.end()); int ans = 0; for (int i = 0; i < n; i++) { int a, b; scanf("%d%d", &a, &b); int j = lower_bound(shr.begin(), shr.end(), a) - shr.begin(); if (j < 0) j = 0; else if (j >= shr.size()) j = shr.size() - 1; else { if (j != shr.size() - 1) if (abs(a - shr[j]) > abs(a - shr[j + 1])) j++; if (j != 0) if (abs(a - shr[j]) > abs(a - shr[j - 1])) j--; } int dst = abs(shr[j] - a) + b; if (dst <= l) ans++; } printf("%d", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2020 KB | Output is correct |
2 | Correct | 0 ms | 2020 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2020 KB | Output is correct |
2 | Correct | 0 ms | 2020 KB | Output is correct |
3 | Correct | 0 ms | 2020 KB | Output is correct |
4 | Correct | 0 ms | 2020 KB | Output is correct |
5 | Correct | 0 ms | 2020 KB | Output is correct |
6 | Correct | 0 ms | 2020 KB | Output is correct |
7 | Correct | 0 ms | 2020 KB | Output is correct |
8 | Correct | 0 ms | 2020 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2020 KB | Output is correct |
2 | Correct | 0 ms | 2020 KB | Output is correct |
3 | Correct | 0 ms | 2020 KB | Output is correct |
4 | Correct | 0 ms | 2020 KB | Output is correct |
5 | Correct | 0 ms | 2020 KB | Output is correct |
6 | Correct | 0 ms | 2020 KB | Output is correct |
7 | Correct | 0 ms | 2020 KB | Output is correct |
8 | Correct | 0 ms | 2020 KB | Output is correct |
9 | Correct | 0 ms | 2020 KB | Output is correct |
10 | Correct | 0 ms | 2020 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2020 KB | Output is correct |
2 | Correct | 0 ms | 2020 KB | Output is correct |
3 | Correct | 0 ms | 2020 KB | Output is correct |
4 | Correct | 0 ms | 2020 KB | Output is correct |
5 | Correct | 0 ms | 2020 KB | Output is correct |
6 | Correct | 0 ms | 2020 KB | Output is correct |
7 | Correct | 0 ms | 2020 KB | Output is correct |
8 | Correct | 0 ms | 2020 KB | Output is correct |
9 | Correct | 0 ms | 2020 KB | Output is correct |
10 | Correct | 0 ms | 2020 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 56 ms | 2212 KB | Output is correct |
2 | Correct | 53 ms | 2308 KB | Output is correct |
3 | Correct | 69 ms | 2344 KB | Output is correct |
4 | Correct | 53 ms | 2248 KB | Output is correct |
5 | Correct | 76 ms | 2312 KB | Output is correct |
6 | Correct | 79 ms | 2376 KB | Output is correct |
7 | Correct | 76 ms | 2384 KB | Output is correct |
8 | Correct | 56 ms | 2200 KB | Output is correct |
9 | Correct | 76 ms | 2392 KB | Output is correct |
10 | Correct | 89 ms | 2384 KB | Output is correct |