Submission #5066

# Submission time Handle Problem Language Result Execution time Memory
5066 2014-01-31T06:04:22 Z Namnamseo 사냥꾼 (KOI13_hunter) C++
100 / 100
68 ms 2140 KB
#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
1 Correct 0 ms 2140 KB Output is correct
2 Correct 0 ms 2132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2140 KB Output is correct
2 Correct 0 ms 2140 KB Output is correct
3 Correct 0 ms 2140 KB Output is correct
4 Correct 0 ms 2140 KB Output is correct
5 Correct 0 ms 2132 KB Output is correct
6 Correct 0 ms 2136 KB Output is correct
7 Correct 0 ms 2136 KB Output is correct
8 Correct 0 ms 2140 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2140 KB Output is correct
2 Correct 0 ms 2136 KB Output is correct
3 Correct 0 ms 2132 KB Output is correct
4 Correct 0 ms 2136 KB Output is correct
5 Correct 0 ms 2140 KB Output is correct
6 Correct 0 ms 2136 KB Output is correct
7 Correct 0 ms 2140 KB Output is correct
8 Correct 0 ms 2136 KB Output is correct
9 Correct 0 ms 2136 KB Output is correct
10 Correct 0 ms 2140 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2136 KB Output is correct
2 Correct 0 ms 2136 KB Output is correct
3 Correct 0 ms 2136 KB Output is correct
4 Correct 0 ms 2132 KB Output is correct
5 Correct 0 ms 2136 KB Output is correct
6 Correct 0 ms 2140 KB Output is correct
7 Correct 0 ms 2132 KB Output is correct
8 Correct 0 ms 2140 KB Output is correct
9 Correct 0 ms 2136 KB Output is correct
10 Correct 0 ms 2136 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 2136 KB Output is correct
2 Correct 44 ms 2136 KB Output is correct
3 Correct 48 ms 2136 KB Output is correct
4 Correct 48 ms 2136 KB Output is correct
5 Correct 64 ms 2132 KB Output is correct
6 Correct 56 ms 2140 KB Output is correct
7 Correct 60 ms 2140 KB Output is correct
8 Correct 44 ms 2132 KB Output is correct
9 Correct 60 ms 2140 KB Output is correct
10 Correct 68 ms 2140 KB Output is correct