Submission #14261

#TimeUsernameProblemLanguageResultExecution timeMemory
14261khsoo01사냥꾼 (KOI13_hunter)C++98
100 / 100
72 ms2256 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...