# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
5066 | Namnamseo | 사냥꾼 (KOI13_hunter) | C++98 | 68 ms | 2140 KiB |
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>
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;
# | 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... |