This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#import<cstdio>
#import<cmath>
#import<algorithm>
using namespace std;
int n,m,l,s[100005],c1,c2,ans;
struct A{
int x,y;
bool operator()(A q,A w){
if(q.x+q.y<w.x+w.y)return true;
return false;
}
}a[100005];
int main()
{
int i;
scanf("%d%d%d",&n,&m,&l);
for(i=0;i<n;i++)scanf("%d",&s[i]);
for(i=0;i<m;i++)scanf("%d%d",&a[i].x,&a[i].y);
sort(s,s+n);
sort(a,a+m,A());
for(;c1<n&&c2<m;){
if(abs(s[c1]-a[c2].x)+a[c2].y<=l)ans++,c2++;
else {
if(s[c1]>=a[c2].x)c2++;
else c1++;
}
}
printf("%d",ans);
}
# | 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... |