답안 #55556

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
55556 2018-07-08T03:11:03 Z red1108 줄서기 (KOI17_line) C++17
100 / 100
244 ms 105856 KB
#include <stdio.h>
int check[100010],help[100010];
int main()
{
    int n, m;
    int i, a, b;
    scanf("%d %d", &n, &m);
    for(i=1;i<=n;i++)
    {
        check[i]=i;
    }
    for(i=1;i<=m;i++)
    {
        scanf("%d %d", &a, &b);
        check[a]++;
        check[b]--;
    }
    for(i=1;i<=n;i++)
    {
        if(check[i]<1||check[i]>n||help[check[i]])
        {
            printf("-1");
            return 0;
        }
        help[check[i]]=1;
    }
    for(i=1;i<=n;i++)
    {
        printf("%d ", check[i]);
    }
}

Compilation message

line.cpp: In function 'int main()':
line.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~~
line.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &a, &b);
         ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 360 KB Output is correct
3 Correct 1 ms 472 KB Output is correct
4 Correct 2 ms 472 KB Output is correct
5 Correct 2 ms 472 KB Output is correct
6 Correct 2 ms 504 KB Output is correct
7 Correct 2 ms 684 KB Output is correct
8 Correct 2 ms 684 KB Output is correct
9 Correct 2 ms 684 KB Output is correct
10 Correct 2 ms 684 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 360 KB Output is correct
3 Correct 1 ms 472 KB Output is correct
4 Correct 2 ms 472 KB Output is correct
5 Correct 2 ms 472 KB Output is correct
6 Correct 2 ms 504 KB Output is correct
7 Correct 2 ms 684 KB Output is correct
8 Correct 2 ms 684 KB Output is correct
9 Correct 2 ms 684 KB Output is correct
10 Correct 2 ms 684 KB Output is correct
11 Correct 3 ms 684 KB Output is correct
12 Correct 2 ms 684 KB Output is correct
13 Correct 3 ms 684 KB Output is correct
14 Correct 2 ms 684 KB Output is correct
15 Correct 3 ms 744 KB Output is correct
16 Correct 2 ms 744 KB Output is correct
17 Correct 5 ms 772 KB Output is correct
18 Correct 2 ms 800 KB Output is correct
19 Correct 2 ms 800 KB Output is correct
20 Correct 2 ms 836 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 360 KB Output is correct
3 Correct 1 ms 472 KB Output is correct
4 Correct 2 ms 472 KB Output is correct
5 Correct 2 ms 472 KB Output is correct
6 Correct 2 ms 504 KB Output is correct
7 Correct 2 ms 684 KB Output is correct
8 Correct 2 ms 684 KB Output is correct
9 Correct 2 ms 684 KB Output is correct
10 Correct 2 ms 684 KB Output is correct
11 Correct 3 ms 684 KB Output is correct
12 Correct 2 ms 684 KB Output is correct
13 Correct 3 ms 684 KB Output is correct
14 Correct 2 ms 684 KB Output is correct
15 Correct 3 ms 744 KB Output is correct
16 Correct 2 ms 744 KB Output is correct
17 Correct 5 ms 772 KB Output is correct
18 Correct 2 ms 800 KB Output is correct
19 Correct 2 ms 800 KB Output is correct
20 Correct 2 ms 836 KB Output is correct
21 Correct 3 ms 1008 KB Output is correct
22 Correct 6 ms 1104 KB Output is correct
23 Correct 12 ms 1388 KB Output is correct
24 Correct 29 ms 2120 KB Output is correct
25 Correct 104 ms 5712 KB Output is correct
26 Correct 25 ms 6748 KB Output is correct
27 Correct 70 ms 9596 KB Output is correct
28 Correct 72 ms 12880 KB Output is correct
29 Correct 143 ms 18944 KB Output is correct
30 Correct 203 ms 27760 KB Output is correct
31 Correct 87 ms 31436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 360 KB Output is correct
3 Correct 1 ms 472 KB Output is correct
4 Correct 2 ms 472 KB Output is correct
5 Correct 2 ms 472 KB Output is correct
6 Correct 2 ms 504 KB Output is correct
7 Correct 2 ms 684 KB Output is correct
8 Correct 2 ms 684 KB Output is correct
9 Correct 2 ms 684 KB Output is correct
10 Correct 2 ms 684 KB Output is correct
11 Correct 3 ms 684 KB Output is correct
12 Correct 2 ms 684 KB Output is correct
13 Correct 3 ms 684 KB Output is correct
14 Correct 2 ms 684 KB Output is correct
15 Correct 3 ms 744 KB Output is correct
16 Correct 2 ms 744 KB Output is correct
17 Correct 5 ms 772 KB Output is correct
18 Correct 2 ms 800 KB Output is correct
19 Correct 2 ms 800 KB Output is correct
20 Correct 2 ms 836 KB Output is correct
21 Correct 3 ms 1008 KB Output is correct
22 Correct 6 ms 1104 KB Output is correct
23 Correct 12 ms 1388 KB Output is correct
24 Correct 29 ms 2120 KB Output is correct
25 Correct 104 ms 5712 KB Output is correct
26 Correct 25 ms 6748 KB Output is correct
27 Correct 70 ms 9596 KB Output is correct
28 Correct 72 ms 12880 KB Output is correct
29 Correct 143 ms 18944 KB Output is correct
30 Correct 203 ms 27760 KB Output is correct
31 Correct 87 ms 31436 KB Output is correct
32 Correct 78 ms 35672 KB Output is correct
33 Correct 237 ms 40560 KB Output is correct
34 Correct 150 ms 48992 KB Output is correct
35 Correct 134 ms 55728 KB Output is correct
36 Correct 147 ms 63808 KB Output is correct
37 Correct 209 ms 73444 KB Output is correct
38 Correct 244 ms 83204 KB Output is correct
39 Correct 238 ms 94912 KB Output is correct
40 Correct 206 ms 105856 KB Output is correct