답안 #20219

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
20219 2016-04-15T05:43:18 Z suwon123 컬러볼 (KOI15_ball) C
0 / 25
1085 ms 3 KB
#include <stdio.h>
#define MAX 200000

int main(void)
{
    int size[MAX], col[MAX], result[MAX] = {0,};
    int num, i, j;
    
    scanf("%d", &num);
    for(i=0; i<num; i++)
        scanf("%d %d", &col[i], &size[i]);
    i=0; j=i+1;
    while(i<num)
    {
        if(j == num)
        {
            i++; j = i+1;
        }
        if(col[i] != col[j] && size[i] > size[j])
            result[i] += size[j];
        j++;
    }
    for(i=0; i<num; i++)
        printf("%d\n", result[i]);
}

Compilation message

ball.c: In function 'main':
ball.c:9:5: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &num);
     ^
ball.c:11:9: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &col[i], &size[i]);
         ^
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1079 ms 2 KB Time limit exceeded
2 Execution timed out 1081 ms 2 KB Time limit exceeded
3 Execution timed out 1059 ms 2 KB Time limit exceeded
4 Execution timed out 1073 ms 2 KB Time limit exceeded
5 Execution timed out 1077 ms 2 KB Time limit exceeded
6 Runtime error 67 ms 2 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 61 ms 2 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 64 ms 2 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 63 ms 2 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 65 ms 2 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Execution timed out 1082 ms 3 KB Time limit exceeded
12 Execution timed out 1077 ms 3 KB Time limit exceeded
13 Execution timed out 1076 ms 3 KB Time limit exceeded
14 Execution timed out 1067 ms 3 KB Time limit exceeded
15 Execution timed out 1064 ms 3 KB Time limit exceeded
16 Execution timed out 1085 ms 3 KB Time limit exceeded
17 Execution timed out 1081 ms 3 KB Time limit exceeded
18 Execution timed out 1079 ms 3 KB Time limit exceeded
19 Execution timed out 1085 ms 3 KB Time limit exceeded
20 Execution timed out 1076 ms 3 KB Time limit exceeded