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>
int i, j, n, m, l, gun[100005], animal[100005][5], cnt[100005], a;
int input()
{
int i;
scanf("%d %d %d",&n,&m,&l);
for(i=1 ; i<=n ; i++)
{
scanf("%d",&gun[i]);
}
for(i=1 ; i<=m ; i++)
{
scanf("%d %d",&animal[i][1],&animal[i][2]);
}
return 0;
}
int process()
{
int i, j, temp;
for(i=1 ; i<=n ; i++)
{
for(j=1 ; j<=m ; j++)
{
if(cnt[j]==0)
{
temp=gun[i]-animal[j][1];
if(temp>=0)
{
temp+=animal[j][2];
}
else
{
temp=temp*(-1);
temp+=animal[j][2];
}
if(temp<=l)
{
cnt[j]=1;
a++;
}
if(a==m)
{
break;
}
}
}
if(j!=m+1)
{
break;
}
}
return 0;
}
int output()
{
printf("%d\n",a);
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... |