답안 #159750

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
159750 2019-10-24T12:31:10 Z geon040702 줄서기 (KOI17_line) C++14
100 / 100
213 ms 12572 KB
#include <bits/stdc++.h>
using namespace std;

bool visit[100010];
int ans[100010];
int n, m;

int main(void)
{
    int i, j;
    scanf("%d%d", &n, &m);

    for(i=1;i<=n;i++) {
        ans[i] = i;
    }

    for(i=1;i<=m;i++) {
        int a, b;
        scanf("%d%d", &a, &b);
        ans[a]++;
        ans[b]--;
    }

    for(i=1;i<=n;i++) {
        if(visit[ans[i]]) {
            printf("-1\n");
            exit(0);
        }
        visit[ans[i]] = 1;
    }

    for(i=1;i<=n;i++) {
        printf("%d ", ans[i]);
    }
    printf("\n");
    return 0;
}

Compilation message

line.cpp: In function 'int main()':
line.cpp:10:12: warning: unused variable 'j' [-Wunused-variable]
     int i, j;
            ^
line.cpp:11: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:19: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 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 380 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 380 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 380 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 3 ms 376 KB Output is correct
21 Correct 3 ms 376 KB Output is correct
22 Correct 6 ms 504 KB Output is correct
23 Correct 10 ms 632 KB Output is correct
24 Correct 18 ms 1088 KB Output is correct
25 Correct 86 ms 3932 KB Output is correct
26 Correct 21 ms 1304 KB Output is correct
27 Correct 62 ms 3320 KB Output is correct
28 Correct 67 ms 3576 KB Output is correct
29 Correct 125 ms 6392 KB Output is correct
30 Correct 177 ms 9080 KB Output is correct
31 Correct 87 ms 4088 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 380 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 3 ms 376 KB Output is correct
21 Correct 3 ms 376 KB Output is correct
22 Correct 6 ms 504 KB Output is correct
23 Correct 10 ms 632 KB Output is correct
24 Correct 18 ms 1088 KB Output is correct
25 Correct 86 ms 3932 KB Output is correct
26 Correct 21 ms 1304 KB Output is correct
27 Correct 62 ms 3320 KB Output is correct
28 Correct 67 ms 3576 KB Output is correct
29 Correct 125 ms 6392 KB Output is correct
30 Correct 177 ms 9080 KB Output is correct
31 Correct 87 ms 4088 KB Output is correct
32 Correct 74 ms 4600 KB Output is correct
33 Correct 96 ms 5624 KB Output is correct
34 Correct 147 ms 8824 KB Output is correct
35 Correct 133 ms 7932 KB Output is correct
36 Correct 144 ms 8824 KB Output is correct
37 Correct 186 ms 10972 KB Output is correct
38 Correct 186 ms 10968 KB Output is correct
39 Correct 213 ms 12572 KB Output is correct
40 Correct 209 ms 12280 KB Output is correct