# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
17597 |
2016-01-01T18:57:09 Z |
Namnamseo |
사냥꾼 (KOI13_hunter) |
C++ |
|
93 ms |
2256 KB |
#include <cstdio>
#include <algorithm>
#define x first
#define y second
using namespace std;
pair<int,int> animal[100010];
int hunter[100010];
int n,m,l;
int abs(int a) { return a>0?a:-a; }
bool canCatch(int h,int a){
return abs(animal[a].x-h)+animal[a].y<=l;
}
int main()
{
scanf("%d%d%d",&m,&n,&l);
int i,j;
for(i=0;i<m;++i) scanf("%d",hunter+i); sort(hunter,hunter+m);
for(i=0;i<n;++i) scanf("%d%d",&animal[i].first,&animal[i].second);
int ans=0;
int lb,rb;
for(i=0;i<n;++i){
if(animal[i].y>l) continue;
lb=animal[i].x+animal[i].y-l;
rb=animal[i].x-animal[i].y+l;
if(lower_bound(hunter,hunter+m,lb)<upper_bound(hunter,hunter+m,rb)) ++ans;
}
printf("%d\n",ans);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2256 KB |
Output is correct |
2 |
Correct |
0 ms |
2256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2256 KB |
Output is correct |
2 |
Correct |
0 ms |
2256 KB |
Output is correct |
3 |
Correct |
0 ms |
2256 KB |
Output is correct |
4 |
Correct |
0 ms |
2256 KB |
Output is correct |
5 |
Correct |
0 ms |
2256 KB |
Output is correct |
6 |
Correct |
0 ms |
2256 KB |
Output is correct |
7 |
Correct |
0 ms |
2256 KB |
Output is correct |
8 |
Correct |
0 ms |
2256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2256 KB |
Output is correct |
2 |
Correct |
0 ms |
2256 KB |
Output is correct |
3 |
Correct |
0 ms |
2256 KB |
Output is correct |
4 |
Correct |
0 ms |
2256 KB |
Output is correct |
5 |
Correct |
0 ms |
2256 KB |
Output is correct |
6 |
Correct |
0 ms |
2256 KB |
Output is correct |
7 |
Correct |
0 ms |
2256 KB |
Output is correct |
8 |
Correct |
0 ms |
2256 KB |
Output is correct |
9 |
Correct |
0 ms |
2256 KB |
Output is correct |
10 |
Correct |
0 ms |
2256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2256 KB |
Output is correct |
2 |
Correct |
0 ms |
2256 KB |
Output is correct |
3 |
Correct |
0 ms |
2256 KB |
Output is correct |
4 |
Correct |
0 ms |
2256 KB |
Output is correct |
5 |
Correct |
0 ms |
2256 KB |
Output is correct |
6 |
Correct |
0 ms |
2256 KB |
Output is correct |
7 |
Correct |
1 ms |
2256 KB |
Output is correct |
8 |
Correct |
0 ms |
2256 KB |
Output is correct |
9 |
Correct |
0 ms |
2256 KB |
Output is correct |
10 |
Correct |
0 ms |
2256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
38 ms |
2256 KB |
Output is correct |
2 |
Correct |
59 ms |
2256 KB |
Output is correct |
3 |
Correct |
57 ms |
2256 KB |
Output is correct |
4 |
Correct |
53 ms |
2256 KB |
Output is correct |
5 |
Correct |
58 ms |
2256 KB |
Output is correct |
6 |
Correct |
93 ms |
2256 KB |
Output is correct |
7 |
Correct |
79 ms |
2256 KB |
Output is correct |
8 |
Correct |
68 ms |
2256 KB |
Output is correct |
9 |
Correct |
63 ms |
2256 KB |
Output is correct |
10 |
Correct |
80 ms |
2256 KB |
Output is correct |