# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
58716 | 2018-07-19T02:14:00 Z | onjo0127(#1933) | Alternating Current (BOI18_alternating) | C++11 | 3000 ms | 2628 KB |
#include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; bool b[100009], r[100009]; pii A[100009]; int main() { int N, M; scanf("%d%d",&N,&M); for(int i=0; i<M; i++) { scanf("%d%d", &A[i].first, &A[i].second); } for(int i=0; i <= (1 << M); i++) { for(int j=0; j<M; j++) { if(i & (1 << j)) { if(A[j].first <= A[j].second) for(int k=A[j].first; k<=A[j].second; k++) b[k] = 1; else { for(int k=A[j].first; k<=N; k++) b[k] = 1; for(int k=1; k<=A[j].second; k++) b[k] = 1; } } else { if(A[j].first <= A[j].second) for(int k=A[j].first; k<=A[j].second; k++) r[k] = 1; else { for(int k=A[j].first; k<=N; k++) r[k] = 1; for(int k=1; k<=A[j].second; k++) r[k] = 1; } } } int c = 0; for(int i=1; i<=N; i++) { if(b[i] && r[i]) ++c; } if(c == N) { for(int j=0; j<M; j++) printf("%d", (i & (1 << j)) ? 1 : 0); return 0; } memset(b, 0, sizeof(b)); memset(r, 0, sizeof(r)); } puts("impossible"); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 504 KB | Output is correct |
2 | Correct | 2 ms | 624 KB | Output is correct |
3 | Correct | 3 ms | 664 KB | Output is correct |
4 | Correct | 4 ms | 664 KB | Output is correct |
5 | Correct | 3 ms | 796 KB | Output is correct |
6 | Correct | 3 ms | 796 KB | Output is correct |
7 | Correct | 2 ms | 896 KB | Output is correct |
8 | Correct | 4 ms | 896 KB | Output is correct |
9 | Correct | 2 ms | 896 KB | Output is correct |
10 | Correct | 8 ms | 896 KB | Output is correct |
11 | Correct | 4 ms | 896 KB | Output is correct |
12 | Correct | 5 ms | 908 KB | Output is correct |
13 | Correct | 22 ms | 984 KB | Output is correct |
14 | Correct | 3 ms | 984 KB | Output is correct |
15 | Correct | 3 ms | 984 KB | Output is correct |
16 | Correct | 49 ms | 984 KB | Output is correct |
17 | Correct | 8 ms | 1040 KB | Output is correct |
18 | Correct | 9 ms | 1040 KB | Output is correct |
19 | Correct | 3 ms | 1040 KB | Output is correct |
20 | Correct | 4 ms | 1040 KB | Output is correct |
21 | Correct | 3 ms | 1040 KB | Output is correct |
22 | Correct | 40 ms | 1040 KB | Output is correct |
23 | Correct | 3 ms | 1040 KB | Output is correct |
24 | Correct | 7 ms | 1040 KB | Output is correct |
25 | Correct | 4 ms | 1040 KB | Output is correct |
26 | Correct | 4 ms | 1040 KB | Output is correct |
27 | Correct | 44 ms | 1040 KB | Output is correct |
28 | Correct | 4 ms | 1040 KB | Output is correct |
29 | Correct | 3 ms | 1040 KB | Output is correct |
30 | Correct | 3 ms | 1040 KB | Output is correct |
31 | Correct | 3 ms | 1040 KB | Output is correct |
32 | Correct | 3 ms | 1040 KB | Output is correct |
33 | Correct | 2 ms | 1040 KB | Output is correct |
34 | Correct | 3 ms | 1040 KB | Output is correct |
35 | Correct | 330 ms | 1112 KB | Output is correct |
36 | Correct | 16 ms | 1112 KB | Output is correct |
37 | Correct | 4 ms | 1112 KB | Output is correct |
38 | Correct | 337 ms | 1112 KB | Output is correct |
39 | Correct | 7 ms | 1112 KB | Output is correct |
40 | Correct | 4 ms | 1112 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 504 KB | Output is correct |
2 | Correct | 2 ms | 624 KB | Output is correct |
3 | Correct | 3 ms | 664 KB | Output is correct |
4 | Correct | 4 ms | 664 KB | Output is correct |
5 | Correct | 3 ms | 796 KB | Output is correct |
6 | Correct | 3 ms | 796 KB | Output is correct |
7 | Correct | 2 ms | 896 KB | Output is correct |
8 | Correct | 4 ms | 896 KB | Output is correct |
9 | Correct | 2 ms | 896 KB | Output is correct |
10 | Correct | 8 ms | 896 KB | Output is correct |
11 | Correct | 4 ms | 896 KB | Output is correct |
12 | Correct | 5 ms | 908 KB | Output is correct |
13 | Correct | 22 ms | 984 KB | Output is correct |
14 | Correct | 3 ms | 984 KB | Output is correct |
15 | Correct | 3 ms | 984 KB | Output is correct |
16 | Correct | 49 ms | 984 KB | Output is correct |
17 | Correct | 8 ms | 1040 KB | Output is correct |
18 | Correct | 9 ms | 1040 KB | Output is correct |
19 | Correct | 3 ms | 1040 KB | Output is correct |
20 | Correct | 4 ms | 1040 KB | Output is correct |
21 | Correct | 3 ms | 1040 KB | Output is correct |
22 | Correct | 40 ms | 1040 KB | Output is correct |
23 | Correct | 3 ms | 1040 KB | Output is correct |
24 | Correct | 7 ms | 1040 KB | Output is correct |
25 | Correct | 4 ms | 1040 KB | Output is correct |
26 | Correct | 4 ms | 1040 KB | Output is correct |
27 | Correct | 44 ms | 1040 KB | Output is correct |
28 | Correct | 4 ms | 1040 KB | Output is correct |
29 | Correct | 3 ms | 1040 KB | Output is correct |
30 | Correct | 3 ms | 1040 KB | Output is correct |
31 | Correct | 3 ms | 1040 KB | Output is correct |
32 | Correct | 3 ms | 1040 KB | Output is correct |
33 | Correct | 2 ms | 1040 KB | Output is correct |
34 | Correct | 3 ms | 1040 KB | Output is correct |
35 | Correct | 330 ms | 1112 KB | Output is correct |
36 | Correct | 16 ms | 1112 KB | Output is correct |
37 | Correct | 4 ms | 1112 KB | Output is correct |
38 | Correct | 337 ms | 1112 KB | Output is correct |
39 | Correct | 7 ms | 1112 KB | Output is correct |
40 | Correct | 4 ms | 1112 KB | Output is correct |
41 | Correct | 3 ms | 1112 KB | Output is correct |
42 | Correct | 14 ms | 1112 KB | Output is correct |
43 | Incorrect | 3 ms | 1112 KB | 'impossible' claimed, but there is a solution |
44 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 504 KB | Output is correct |
2 | Correct | 2 ms | 624 KB | Output is correct |
3 | Correct | 3 ms | 664 KB | Output is correct |
4 | Correct | 4 ms | 664 KB | Output is correct |
5 | Correct | 3 ms | 796 KB | Output is correct |
6 | Correct | 3 ms | 796 KB | Output is correct |
7 | Correct | 2 ms | 896 KB | Output is correct |
8 | Correct | 4 ms | 896 KB | Output is correct |
9 | Correct | 2 ms | 896 KB | Output is correct |
10 | Correct | 8 ms | 896 KB | Output is correct |
11 | Correct | 4 ms | 896 KB | Output is correct |
12 | Correct | 5 ms | 908 KB | Output is correct |
13 | Correct | 22 ms | 984 KB | Output is correct |
14 | Correct | 3 ms | 984 KB | Output is correct |
15 | Correct | 3 ms | 984 KB | Output is correct |
16 | Correct | 49 ms | 984 KB | Output is correct |
17 | Correct | 8 ms | 1040 KB | Output is correct |
18 | Correct | 9 ms | 1040 KB | Output is correct |
19 | Correct | 3 ms | 1040 KB | Output is correct |
20 | Correct | 4 ms | 1040 KB | Output is correct |
21 | Correct | 3 ms | 1040 KB | Output is correct |
22 | Correct | 40 ms | 1040 KB | Output is correct |
23 | Correct | 3 ms | 1040 KB | Output is correct |
24 | Correct | 7 ms | 1040 KB | Output is correct |
25 | Correct | 4 ms | 1040 KB | Output is correct |
26 | Correct | 4 ms | 1040 KB | Output is correct |
27 | Correct | 44 ms | 1040 KB | Output is correct |
28 | Correct | 4 ms | 1040 KB | Output is correct |
29 | Correct | 3 ms | 1040 KB | Output is correct |
30 | Correct | 3 ms | 1040 KB | Output is correct |
31 | Correct | 3 ms | 1040 KB | Output is correct |
32 | Correct | 3 ms | 1040 KB | Output is correct |
33 | Correct | 2 ms | 1040 KB | Output is correct |
34 | Correct | 3 ms | 1040 KB | Output is correct |
35 | Correct | 330 ms | 1112 KB | Output is correct |
36 | Correct | 16 ms | 1112 KB | Output is correct |
37 | Correct | 4 ms | 1112 KB | Output is correct |
38 | Correct | 337 ms | 1112 KB | Output is correct |
39 | Correct | 7 ms | 1112 KB | Output is correct |
40 | Correct | 4 ms | 1112 KB | Output is correct |
41 | Correct | 3 ms | 1112 KB | Output is correct |
42 | Correct | 14 ms | 1112 KB | Output is correct |
43 | Incorrect | 3 ms | 1112 KB | 'impossible' claimed, but there is a solution |
44 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3044 ms | 2628 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 504 KB | Output is correct |
2 | Correct | 2 ms | 624 KB | Output is correct |
3 | Correct | 3 ms | 664 KB | Output is correct |
4 | Correct | 4 ms | 664 KB | Output is correct |
5 | Correct | 3 ms | 796 KB | Output is correct |
6 | Correct | 3 ms | 796 KB | Output is correct |
7 | Correct | 2 ms | 896 KB | Output is correct |
8 | Correct | 4 ms | 896 KB | Output is correct |
9 | Correct | 2 ms | 896 KB | Output is correct |
10 | Correct | 8 ms | 896 KB | Output is correct |
11 | Correct | 4 ms | 896 KB | Output is correct |
12 | Correct | 5 ms | 908 KB | Output is correct |
13 | Correct | 22 ms | 984 KB | Output is correct |
14 | Correct | 3 ms | 984 KB | Output is correct |
15 | Correct | 3 ms | 984 KB | Output is correct |
16 | Correct | 49 ms | 984 KB | Output is correct |
17 | Correct | 8 ms | 1040 KB | Output is correct |
18 | Correct | 9 ms | 1040 KB | Output is correct |
19 | Correct | 3 ms | 1040 KB | Output is correct |
20 | Correct | 4 ms | 1040 KB | Output is correct |
21 | Correct | 3 ms | 1040 KB | Output is correct |
22 | Correct | 40 ms | 1040 KB | Output is correct |
23 | Correct | 3 ms | 1040 KB | Output is correct |
24 | Correct | 7 ms | 1040 KB | Output is correct |
25 | Correct | 4 ms | 1040 KB | Output is correct |
26 | Correct | 4 ms | 1040 KB | Output is correct |
27 | Correct | 44 ms | 1040 KB | Output is correct |
28 | Correct | 4 ms | 1040 KB | Output is correct |
29 | Correct | 3 ms | 1040 KB | Output is correct |
30 | Correct | 3 ms | 1040 KB | Output is correct |
31 | Correct | 3 ms | 1040 KB | Output is correct |
32 | Correct | 3 ms | 1040 KB | Output is correct |
33 | Correct | 2 ms | 1040 KB | Output is correct |
34 | Correct | 3 ms | 1040 KB | Output is correct |
35 | Correct | 330 ms | 1112 KB | Output is correct |
36 | Correct | 16 ms | 1112 KB | Output is correct |
37 | Correct | 4 ms | 1112 KB | Output is correct |
38 | Correct | 337 ms | 1112 KB | Output is correct |
39 | Correct | 7 ms | 1112 KB | Output is correct |
40 | Correct | 4 ms | 1112 KB | Output is correct |
41 | Correct | 3 ms | 1112 KB | Output is correct |
42 | Correct | 14 ms | 1112 KB | Output is correct |
43 | Incorrect | 3 ms | 1112 KB | 'impossible' claimed, but there is a solution |
44 | Halted | 0 ms | 0 KB | - |