Submission #5066

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
50662014-01-31 06:04:22Namnamseo사냥꾼 (KOI13_hunter)C++98
100 / 100
68 ms2140 KiB
#include <stdio.h>
#include <algorithm>
using namespace std;
int main()
{
int n,m,l,ans=0;
bool tmp;
int i,j;
scanf("%d%d%d",&m,&n,&l);
int hunter[100001];
pair<int,int> animal[100001];
for(i=0;i<m;i++) scanf("%d",&hunter[i]);
for(i=0;i<n;i++) scanf("%d%d",&animal[i].first,&animal[i].second);
sort(hunter,hunter+m);
sort(animal,animal+n);
for(i=0,j=0;i<n;i++){
while(j<m && hunter[j]<animal[i].first) j++;
tmp=false;
if(j>0){
if(animal[i].first - hunter[j-1] + animal[i].second <= l) tmp=true;
}
if(j<m){
if(hunter[j]-animal[i].first+animal[i].second <= l) tmp=true;
}
if(tmp) ans++;
}
printf("%d",ans);
return 0;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...