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>
#include<math.h>
struct A
{
int x, y;
};
A animal[100002];
int m, n, l;
int h[100002], get;
struct SORTF
{
bool inline operator () (A a, A b)
{
return a.x < b.x;
}
};
struct sortf
{
bool inline operator () (A a, A b)
{
return a.y < b.y;
}
};
int input()
{
int i, k, c;
scanf("%d %d %d",&m,&n,&l);
for(i=1 ; i<=m ; i++)
{
scanf("%d",&h[i]);
}
for(i=1 ; i<=n ; i++)
{
scanf("%d %d",&animal[i].x,&animal[i].y);
}
std::sort(h+1,h+m+1);
std::sort(animal+1,animal+1+n,SORTF());
k=0;
for(i=2 ; i<=n ; i++)
{
if(animal[i].x==animal[i-1].x && k==0)
{
k=i-1;
}
c=i-1;
if(animal[i].x!=animal[i-1].x)
{
std::sort(animal+k,animal+1+c,sortf());
k=i;
}
}
return 0;
}
int process()
{
int d1, d2, cnt=1, i, c, comp, k;
for(i=1 ; i<=n ; i++)
{
d1=abs(h[cnt]-animal[i].x);
d2=animal[i].y;
c=cnt;
while(l<d1)
{
cnt++;
d1=abs(h[cnt]-animal[i].x)+animal[i].y;
}
if(l>=d1+d2 || l>=abs(h[cnt+1]-animal[i].x)+animal[i].y) get++;
}
return 0;
}
int output()
{
printf("%d",get);
return 0;
}
int main()
{
input();
process();
output();
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... |