# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
76047 |
2018-09-12T01:27:53 Z |
chunghan |
사냥꾼 (KOI13_hunter) |
C++14 |
|
159 ms |
1604 KB |
#include<iostream>
#include<algorithm>
#include<math.h>
using namespace std;
typedef pair<int, int> pii;
int m, n, l, x[100000], cnt;
pii ani[100000];
int dist(int a, int x) {
return abs(x - ani[a].first) + ani[a].second;
}
int find(int a) {
int start = 0, end = m-1;
int mid, rst, ld = 0, hd = 0;
bool find = false;
while(start <= end) {
mid = (start+end)/2;
if(x[mid] < a) start = mid+1;
else if(x[mid] > a) end = mid-1;
else {
rst = mid;
find = true;
break;
}
}
if(!find) {
ld = abs(a-x[start]);
hd = abs(a-x[end]);
rst = ld < hd ? start : end;
}
return rst;
}
int main() {
cin >> m >> n >> l;
for(int i = 0; i < m; i++)
cin >> x[i];
for(int i = 0, a, b; i < n; i++) {
cin >> a >> b;
ani[i] = pii(a, b);
}
sort(x, x+m);
//sort(ani, ani+n);
//cout << x[find(7)] << endl;
for(int i = 0; i < n; i++) {
//cout << dist(i, x[find(ani[i].first)]) << ' ' << x[find(ani[i].first)] << ' ' << ani[i].first << ' ' << ani[i].second << endl;
if(dist(i, x[find(ani[i].first)]) <= l) {
//cout << ani[i].first << ' ' << ani[i].second << endl;
cnt++;
}
}
cout << cnt;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
380 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
456 KB |
Output is correct |
2 |
Correct |
4 ms |
500 KB |
Output is correct |
3 |
Correct |
2 ms |
500 KB |
Output is correct |
4 |
Correct |
2 ms |
672 KB |
Output is correct |
5 |
Correct |
2 ms |
672 KB |
Output is correct |
6 |
Correct |
2 ms |
672 KB |
Output is correct |
7 |
Correct |
2 ms |
672 KB |
Output is correct |
8 |
Correct |
2 ms |
672 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
672 KB |
Output is correct |
2 |
Correct |
2 ms |
672 KB |
Output is correct |
3 |
Correct |
2 ms |
672 KB |
Output is correct |
4 |
Correct |
2 ms |
716 KB |
Output is correct |
5 |
Correct |
2 ms |
720 KB |
Output is correct |
6 |
Correct |
2 ms |
720 KB |
Output is correct |
7 |
Correct |
2 ms |
720 KB |
Output is correct |
8 |
Correct |
2 ms |
720 KB |
Output is correct |
9 |
Correct |
2 ms |
720 KB |
Output is correct |
10 |
Correct |
2 ms |
720 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
720 KB |
Output is correct |
2 |
Correct |
4 ms |
720 KB |
Output is correct |
3 |
Correct |
3 ms |
720 KB |
Output is correct |
4 |
Incorrect |
4 ms |
720 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
97 ms |
1212 KB |
Output is correct |
2 |
Correct |
117 ms |
1408 KB |
Output is correct |
3 |
Correct |
131 ms |
1532 KB |
Output is correct |
4 |
Correct |
114 ms |
1532 KB |
Output is correct |
5 |
Correct |
159 ms |
1604 KB |
Output is correct |
6 |
Incorrect |
157 ms |
1604 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |