This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |