Submission #14261

# Submission time Handle Problem Language Result Execution time Memory
14261 2015-05-09T00:10:16 Z khsoo01 사냥꾼 (KOI13_hunter) C++
100 / 100
72 ms 2256 KB
#import<cstdio>
#import<cmath>
#import<algorithm>
using namespace std;
int n,m,l,s[100005],c1,c2,ans;
struct A{
    int x,y;
    bool operator()(A q,A w){
        if(q.x+q.y<w.x+w.y)return true;
        return false;
    }
}a[100005];

int main()
{
    int i;
    scanf("%d%d%d",&n,&m,&l);
    for(i=0;i<n;i++)scanf("%d",&s[i]);
    for(i=0;i<m;i++)scanf("%d%d",&a[i].x,&a[i].y);
    sort(s,s+n);
    sort(a,a+m,A());
    for(;c1<n&&c2<m;){
        if(abs(s[c1]-a[c2].x)+a[c2].y<=l)ans++,c2++;
        else {
            if(s[c1]>=a[c2].x)c2++;
            else c1++;
        }
    }
    printf("%d",ans);
}
# 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 0 ms 2256 KB Output is correct
9 Correct 1 ms 2256 KB Output is correct
10 Correct 0 ms 2256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 37 ms 2256 KB Output is correct
2 Correct 44 ms 2256 KB Output is correct
3 Correct 41 ms 2256 KB Output is correct
4 Correct 45 ms 2256 KB Output is correct
5 Correct 57 ms 2256 KB Output is correct
6 Correct 57 ms 2256 KB Output is correct
7 Correct 54 ms 2256 KB Output is correct
8 Correct 40 ms 2256 KB Output is correct
9 Correct 71 ms 2256 KB Output is correct
10 Correct 72 ms 2256 KB Output is correct