Submission #76049

# Submission time Handle Problem Language Result Execution time Memory
76049 2018-09-12T01:36:44 Z chunghan 사냥꾼 (KOI13_hunter) C++14
0 / 100
99 ms 1508 KB
#include<iostream>
#include<algorithm>
#include<math.h>

using namespace std;

typedef pair<int, int> pii;

int m, n, l, x[100000], cnt, c[100000];
pii ani[100000];

int dist(int a, int x) {
    return abs(x - ani[a].first) + ani[a].second;
}

void find() {
    int k = 0;
    for(int i = 0; i < n; i++) {
        if(abs(ani[i].first-x[k]) > abs(ani[i].first-x[k+1]))
            k++;
        c[i] = k;
    }
}

int main() {
    cin >> m >> n >> l;
    for(int i = 0; i < m; i++)
        cin >> x[i];
    for(int i = 0, a, b; i < n; i++) {
        cin >> a >> b;
        ani[i] = pii(a, b);
    }
    sort(x, x+m);
    sort(ani, ani+n);
    find();
    for(int i = 0; i < n; i++)
        if(dist(i, x[c[i]]) <= l) cnt++;
    cout << cnt;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 508 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 508 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 508 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 532 KB Output is correct
2 Incorrect 4 ms 676 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 99 ms 1508 KB Output isn't correct
2 Halted 0 ms 0 KB -