# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
4949 |
2014-01-23T13:18:16 Z |
hana5505 |
사냥꾼 (KOI13_hunter) |
C++ |
|
76 ms |
12804 KB |
#include<stdio.h>
#include<algorithm>
using namespace std;
struct pp{
int x,y;
}animal[1000001];
int hunter[1000001];
int ab(int k){
if(k<0) return -k;
return k;
}
int main()
{
int m,n,l,i,j,cnt=0,ans=0;
scanf("%d %d %d",&m,&n,&l);
for(i=1;i<=m;i++)
scanf("%d",&hunter[i]);
for(i=1;i<=n;i++)
scanf("%d %d",&animal[i].x,&animal[i].y);
sort(hunter+1,hunter+m+1);
for(i=1;i<=n;i++){
cnt=0;
j=lower_bound(hunter+1,hunter+m+1,animal[i].x)-hunter;
if(j-1>=1){
if(ab(hunter[j-1]-animal[i].x)+animal[i].y<=l) cnt++;
}
if(j>=1 && j<=m){
if(ab(hunter[j]-animal[i].x)+animal[i].y<=l) cnt++;
}
if(j+1<=m){
if(ab(hunter[j+1]-animal[i].x)+animal[i].y<=l) cnt++;
}
if(cnt) ans++;
}
printf("%d",ans);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
12804 KB |
Output is correct |
2 |
Correct |
0 ms |
12804 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
12804 KB |
Output is correct |
2 |
Correct |
0 ms |
12804 KB |
Output is correct |
3 |
Correct |
0 ms |
12804 KB |
Output is correct |
4 |
Correct |
0 ms |
12804 KB |
Output is correct |
5 |
Correct |
0 ms |
12804 KB |
Output is correct |
6 |
Correct |
0 ms |
12804 KB |
Output is correct |
7 |
Correct |
0 ms |
12804 KB |
Output is correct |
8 |
Correct |
0 ms |
12804 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
12804 KB |
Output is correct |
2 |
Correct |
0 ms |
12804 KB |
Output is correct |
3 |
Correct |
0 ms |
12804 KB |
Output is correct |
4 |
Correct |
0 ms |
12804 KB |
Output is correct |
5 |
Correct |
0 ms |
12804 KB |
Output is correct |
6 |
Correct |
0 ms |
12804 KB |
Output is correct |
7 |
Correct |
0 ms |
12804 KB |
Output is correct |
8 |
Correct |
0 ms |
12804 KB |
Output is correct |
9 |
Correct |
0 ms |
12804 KB |
Output is correct |
10 |
Correct |
0 ms |
12804 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
12804 KB |
Output is correct |
2 |
Correct |
0 ms |
12804 KB |
Output is correct |
3 |
Correct |
0 ms |
12804 KB |
Output is correct |
4 |
Correct |
0 ms |
12804 KB |
Output is correct |
5 |
Correct |
0 ms |
12804 KB |
Output is correct |
6 |
Correct |
0 ms |
12804 KB |
Output is correct |
7 |
Correct |
0 ms |
12804 KB |
Output is correct |
8 |
Correct |
0 ms |
12804 KB |
Output is correct |
9 |
Correct |
0 ms |
12804 KB |
Output is correct |
10 |
Correct |
0 ms |
12804 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
36 ms |
12804 KB |
Output is correct |
2 |
Correct |
48 ms |
12804 KB |
Output is correct |
3 |
Correct |
48 ms |
12804 KB |
Output is correct |
4 |
Correct |
48 ms |
12804 KB |
Output is correct |
5 |
Correct |
52 ms |
12804 KB |
Output is correct |
6 |
Correct |
60 ms |
12804 KB |
Output is correct |
7 |
Correct |
76 ms |
12804 KB |
Output is correct |
8 |
Correct |
48 ms |
12804 KB |
Output is correct |
9 |
Correct |
64 ms |
12804 KB |
Output is correct |
10 |
Correct |
68 ms |
12804 KB |
Output is correct |