# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
27372 | jakehsj | 사냥꾼 (KOI13_hunter) | C++14 | 86 ms | 2292 KiB |
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 <stdio.h>
#include <algorithm>
using namespace std;
int x[100020];
struct xy{
int dx,dy;
};
xy dist[100020];
bool cmp(xy p, xy q)
{
return p.dx<q.dx;
}
int abs(int x)
{
if(x<0)
return -x;
return x;
}
int main()
{
int m,n,l;
scanf("%d%d%d",&m,&n,&l);
for(int i=0;i<m;i++)
scanf("%d",&x[i]);
sort(x,x+m);
for(int i=0;i<n;i++)
scanf("%d%d",&dist[i].dx,&dist[i].dy);
sort(dist,dist+n,cmp);
int s,e;
s=0;
int k=0;
int ans=0;
for(int i=0;i<m;i++)
{
e=(x[i]+x[i+1])/2;
if(i==m-1)
e=x[i]+l;
while(dist[k].dx>=s&&dist[k].dx<=e&&k<n)
{
if(abs(dist[k].dx-x[i])+dist[k].dy<=l)
ans++;
k++;
}
s=e+1;
}
printf("%d",ans);
}
Compilation message (stderr)
# | 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... |