# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
29563 | 2017-07-20T06:13:28 Z | undecember | 사냥꾼 (KOI13_hunter) | C++14 | 86 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2020 KB | Output is correct |
2 | Correct | 0 ms | 2020 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | 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 |
# | 결과 | 실행 시간 | 메모리 | 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 |
# | 결과 | 실행 시간 | 메모리 | 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 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 46 ms | 2212 KB | Output is correct |
2 | Correct | 56 ms | 2308 KB | Output is correct |
3 | Correct | 83 ms | 2344 KB | Output is correct |
4 | Correct | 59 ms | 2248 KB | Output is correct |
5 | Correct | 73 ms | 2312 KB | Output is correct |
6 | Correct | 69 ms | 2376 KB | Output is correct |
7 | Correct | 79 ms | 2384 KB | Output is correct |
8 | Correct | 69 ms | 2200 KB | Output is correct |
9 | Correct | 86 ms | 2392 KB | Output is correct |
10 | Correct | 79 ms | 2384 KB | Output is correct |