Submission #14679

# Submission time Handle Problem Language Result Execution time Memory
14679 2015-06-03T05:49:22 Z Fakeable 사냥꾼 (KOI13_hunter) C++
100 / 100
85 ms 2256 KB
#include<cstdio>
#include<algorithm>
#include<utility>
#define pi pair<int,int>
using namespace std;
const int max_n = 100100;
int n,d,l,x[max_n];
pi p[max_n];
inline int Abs(int x) {
    return x>0?x:-x;
}
void input() {
    scanf("%d %d %d",&n,&d,&l);
    for(int i=0;i<n;i++) scanf("%d",&x[i]);
    x[n] = 2000000001;
    for(int i=0;i<d;i++) scanf("%d %d",&p[i].first, &p[i].second);
    sort(x,x+n);
    return;
}
int find(int front,int rear,int crit) {
    if(front == rear) return front;
    int mid = (front + rear + 1) / 2;
    if(x[mid] >= crit) return find(front,mid-1,crit);
    return find(mid,rear,crit);
}
void solve() {
    int print = 0;
    for(int i=0;i<d;i++) {
        int close = find(0,n-1,p[i].first);
        if(l-p[i].second >= Abs(p[i].first - x[close]) || l-p[i].second >= Abs(p[i].first-x[close+1])) print++;
    }
    printf("%d\n",print);
    return;
}
int main() {
    input();
    solve();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2256 KB Output is correct
2 Correct 0 ms 2256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2256 KB Output is correct
2 Correct 0 ms 2256 KB Output is correct
3 Correct 0 ms 2256 KB Output is correct
4 Correct 0 ms 2256 KB Output is correct
5 Correct 0 ms 2256 KB Output is correct
6 Correct 0 ms 2256 KB Output is correct
7 Correct 0 ms 2256 KB Output is correct
8 Correct 0 ms 2256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2256 KB Output is correct
2 Correct 0 ms 2256 KB Output is correct
3 Correct 0 ms 2256 KB Output is correct
4 Correct 0 ms 2256 KB Output is correct
5 Correct 0 ms 2256 KB Output is correct
6 Correct 0 ms 2256 KB Output is correct
7 Correct 0 ms 2256 KB Output is correct
8 Correct 0 ms 2256 KB Output is correct
9 Correct 0 ms 2256 KB Output is correct
10 Correct 0 ms 2256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2256 KB Output is correct
2 Correct 0 ms 2256 KB Output is correct
3 Correct 0 ms 2256 KB Output is correct
4 Correct 0 ms 2256 KB Output is correct
5 Correct 0 ms 2256 KB Output is correct
6 Correct 0 ms 2256 KB Output is correct
7 Correct 0 ms 2256 KB Output is correct
8 Correct 2 ms 2256 KB Output is correct
9 Correct 0 ms 2256 KB Output is correct
10 Correct 0 ms 2256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 52 ms 2256 KB Output is correct
2 Correct 60 ms 2256 KB Output is correct
3 Correct 58 ms 2256 KB Output is correct
4 Correct 37 ms 2256 KB Output is correct
5 Correct 57 ms 2256 KB Output is correct
6 Correct 68 ms 2256 KB Output is correct
7 Correct 54 ms 2256 KB Output is correct
8 Correct 63 ms 2256 KB Output is correct
9 Correct 71 ms 2256 KB Output is correct
10 Correct 85 ms 2256 KB Output is correct