Submission #4994

# Submission time Handle Problem Language Result Execution time Memory
4994 2014-01-24T14:41:49 Z ansol4328 사냥꾼 (KOI13_hunter) C++
100 / 100
72 ms 2264 KB
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>

struct xy
{
    int x, y;
};

int cmp(const xy &aa, const xy &bb)
{
    return aa.x<bb.x || (aa.x==bb.x && aa.y<bb.y);
}

xy a[100002];

int n, m, l, g[100002];
int cnt;

int input()
{
    int i;
    scanf("%d %d %d",&m,&n,&l);
    for(i=1 ; i<=m ; i++) scanf("%d",&g[i]);
    for(i=1 ; i<=n ; i++) scanf("%d %d",&a[i].x,&a[i].y);
    std::sort(g+1,g+1+m);
    std::sort(a+1,a+1+n,cmp);
    return 0;
}

int process()
{
    int i=1, j=1, d;

    while(j<=n)
    {
        while(g[i]+(g[i+1]-g[i])/2+(g[i+1]-g[i])%2<=a[j].x && i!=m) {i++;}
        d=abs(a[j].x-g[i])+a[j].y;
        if(d<=l) cnt++;
        j++;
    }
    return 0;
}

int output()
{
    printf("%d",cnt);
    return 0;
}

int main()
{
    input();
    process();
    output();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2264 KB Output is correct
2 Correct 0 ms 2264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2264 KB Output is correct
2 Correct 0 ms 2264 KB Output is correct
3 Correct 0 ms 2264 KB Output is correct
4 Correct 0 ms 2264 KB Output is correct
5 Correct 0 ms 2264 KB Output is correct
6 Correct 0 ms 2264 KB Output is correct
7 Correct 0 ms 2264 KB Output is correct
8 Correct 0 ms 2264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2264 KB Output is correct
2 Correct 0 ms 2264 KB Output is correct
3 Correct 0 ms 2264 KB Output is correct
4 Correct 0 ms 2264 KB Output is correct
5 Correct 0 ms 2264 KB Output is correct
6 Correct 0 ms 2264 KB Output is correct
7 Correct 0 ms 2264 KB Output is correct
8 Correct 0 ms 2264 KB Output is correct
9 Correct 0 ms 2264 KB Output is correct
10 Correct 0 ms 2264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2264 KB Output is correct
2 Correct 0 ms 2264 KB Output is correct
3 Correct 0 ms 2264 KB Output is correct
4 Correct 0 ms 2264 KB Output is correct
5 Correct 0 ms 2264 KB Output is correct
6 Correct 0 ms 2264 KB Output is correct
7 Correct 0 ms 2264 KB Output is correct
8 Correct 0 ms 2264 KB Output is correct
9 Correct 0 ms 2264 KB Output is correct
10 Correct 0 ms 2264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 2264 KB Output is correct
2 Correct 52 ms 2264 KB Output is correct
3 Correct 48 ms 2264 KB Output is correct
4 Correct 48 ms 2264 KB Output is correct
5 Correct 68 ms 2264 KB Output is correct
6 Correct 64 ms 2264 KB Output is correct
7 Correct 64 ms 2264 KB Output is correct
8 Correct 52 ms 2264 KB Output is correct
9 Correct 72 ms 2264 KB Output is correct
10 Correct 64 ms 2264 KB Output is correct