답안 #4504

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
4504 2013-10-14T06:13:28 Z ansol1111 사냥꾼 (KOI13_hunter) C++
70 / 100
1000 ms 3820 KB
#include<stdio.h>

int i, j, n, m, l, gun[100005], animal[100005][5], cnt[100005], a;

int input()
{
  	int i;
    scanf("%d %d %d",&n,&m,&l);
    for(i=1 ; i<=n ; i++)
    {
        scanf("%d",&gun[i]);
    }
    for(i=1 ; i<=m ; i++)
    {
        scanf("%d %d",&animal[i][1],&animal[i][2]);
    }
    return 0;
}

int process()
{
    int i, j, temp;

    for(i=1 ; i<=n ; i++)
    {
        for(j=1 ; j<=m ; j++)
        {
            if(cnt[j]==0)
            {
                temp=gun[i]-animal[j][1];
                if(temp>=0)
                {
                    temp+=animal[j][2];
                }
                else
                {
                    temp=temp*(-1);
                    temp+=animal[j][2];
                }
                if(temp<=l)
                {
                    cnt[j]=1;
                    a++;
                }
                if(a==m)
                {
                    break;
                }
            }
        }
        if(j!=m+1)
        {
            break;
        }
    }
    return 0;
}

int output()
{
    printf("%d\n",a);
    return 0;
}

int main()
{
    input();
    process();
    output();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3820 KB Output is correct
2 Correct 0 ms 3820 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3820 KB Output is correct
2 Correct 0 ms 3820 KB Output is correct
3 Correct 0 ms 3820 KB Output is correct
4 Correct 0 ms 3820 KB Output is correct
5 Correct 0 ms 3820 KB Output is correct
6 Correct 0 ms 3820 KB Output is correct
7 Correct 0 ms 3820 KB Output is correct
8 Correct 0 ms 3820 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3820 KB Output is correct
2 Correct 0 ms 3820 KB Output is correct
3 Correct 0 ms 3820 KB Output is correct
4 Correct 0 ms 3820 KB Output is correct
5 Correct 0 ms 3820 KB Output is correct
6 Correct 0 ms 3820 KB Output is correct
7 Correct 0 ms 3820 KB Output is correct
8 Correct 0 ms 3820 KB Output is correct
9 Correct 0 ms 3820 KB Output is correct
10 Correct 0 ms 3820 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3820 KB Output is correct
2 Correct 0 ms 3820 KB Output is correct
3 Correct 0 ms 3820 KB Output is correct
4 Correct 8 ms 3820 KB Output is correct
5 Correct 16 ms 3820 KB Output is correct
6 Correct 20 ms 3820 KB Output is correct
7 Correct 24 ms 3820 KB Output is correct
8 Correct 20 ms 3820 KB Output is correct
9 Correct 4 ms 3820 KB Output is correct
10 Correct 16 ms 3820 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1000 ms 3816 KB Program timed out
2 Halted 0 ms 0 KB -