# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
280345 | 2020-08-22T16:33:59 Z | spdskatr | Joker (BOI20_joker) | C++14 | 83 ms | 632 KB |
#include <cstdio> #include <cstdlib> #include <algorithm> #include <vector> #include <cstring> #define fi first #define se second using namespace std; typedef pair<int, int> pii; int N, M, Q, seen[2005], col[2005]; vector<pii> graph[2005]; int dfs(int x, int l, int r) { seen[x] = 1; for (pii p : graph[x]) { int v = p.fi, e = p.se; if (e < l || e > r) { if (seen[v]) { if (col[v] == col[x]) return 1; } else { col[v] = !col[x]; if (dfs(v, l, r)) return 1; } } } return 0; } int main() { scanf("%d %d %d", &N, &M, &Q); for (int i = 1; i <= M; i++) { int a, b; scanf("%d %d", &a, &b); graph[a].push_back({ b, i }); graph[b].push_back({ a, i }); } for (int q = 0; q < Q; q++) { int l, r; scanf("%d %d", &l, &r); memset(seen, 0, sizeof(seen)); memset(col, 0, sizeof(col)); int nice = 0; for (int i = 1; i <= N; i++) { if (!seen[i]) if (dfs(i, l, r)) { nice = 1; break; } } if (nice) printf("YES\n"); else printf("NO\n"); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 512 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 1 ms | 384 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Correct | 1 ms | 384 KB | Output is correct |
12 | Correct | 2 ms | 384 KB | Output is correct |
13 | Correct | 1 ms | 384 KB | Output is correct |
14 | Correct | 2 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 384 KB | Output is correct |
16 | Correct | 2 ms | 384 KB | Output is correct |
17 | Correct | 1 ms | 384 KB | Output is correct |
18 | Correct | 1 ms | 384 KB | Output is correct |
19 | Correct | 3 ms | 384 KB | Output is correct |
20 | Correct | 1 ms | 384 KB | Output is correct |
21 | Correct | 1 ms | 384 KB | Output is correct |
22 | Correct | 1 ms | 384 KB | Output is correct |
23 | Correct | 1 ms | 384 KB | Output is correct |
24 | Correct | 1 ms | 384 KB | Output is correct |
25 | Correct | 2 ms | 384 KB | Output is correct |
26 | Correct | 1 ms | 384 KB | Output is correct |
27 | Correct | 1 ms | 384 KB | Output is correct |
28 | Correct | 1 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 512 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 1 ms | 384 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Correct | 1 ms | 384 KB | Output is correct |
12 | Correct | 2 ms | 384 KB | Output is correct |
13 | Correct | 1 ms | 384 KB | Output is correct |
14 | Correct | 2 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 384 KB | Output is correct |
16 | Correct | 2 ms | 384 KB | Output is correct |
17 | Correct | 1 ms | 384 KB | Output is correct |
18 | Correct | 1 ms | 384 KB | Output is correct |
19 | Correct | 3 ms | 384 KB | Output is correct |
20 | Correct | 1 ms | 384 KB | Output is correct |
21 | Correct | 1 ms | 384 KB | Output is correct |
22 | Correct | 1 ms | 384 KB | Output is correct |
23 | Correct | 1 ms | 384 KB | Output is correct |
24 | Correct | 1 ms | 384 KB | Output is correct |
25 | Correct | 2 ms | 384 KB | Output is correct |
26 | Correct | 1 ms | 384 KB | Output is correct |
27 | Correct | 1 ms | 384 KB | Output is correct |
28 | Correct | 1 ms | 384 KB | Output is correct |
29 | Correct | 83 ms | 504 KB | Output is correct |
30 | Correct | 57 ms | 512 KB | Output is correct |
31 | Correct | 42 ms | 512 KB | Output is correct |
32 | Correct | 21 ms | 512 KB | Output is correct |
33 | Correct | 10 ms | 512 KB | Output is correct |
34 | Correct | 41 ms | 512 KB | Output is correct |
35 | Correct | 60 ms | 512 KB | Output is correct |
36 | Correct | 18 ms | 512 KB | Output is correct |
37 | Correct | 65 ms | 512 KB | Output is correct |
38 | Correct | 79 ms | 512 KB | Output is correct |
39 | Correct | 52 ms | 512 KB | Output is correct |
40 | Correct | 25 ms | 512 KB | Output is correct |
41 | Correct | 25 ms | 512 KB | Output is correct |
42 | Correct | 27 ms | 512 KB | Output is correct |
43 | Correct | 9 ms | 512 KB | Output is correct |
44 | Correct | 7 ms | 512 KB | Output is correct |
45 | Correct | 10 ms | 544 KB | Output is correct |
46 | Correct | 14 ms | 512 KB | Output is correct |
47 | Correct | 27 ms | 512 KB | Output is correct |
48 | Correct | 30 ms | 512 KB | Output is correct |
49 | Correct | 38 ms | 528 KB | Output is correct |
50 | Correct | 48 ms | 524 KB | Output is correct |
51 | Correct | 28 ms | 512 KB | Output is correct |
52 | Correct | 36 ms | 512 KB | Output is correct |
53 | Correct | 42 ms | 632 KB | Output is correct |
54 | Correct | 57 ms | 512 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 512 KB | Output is correct |
3 | Runtime error | 1 ms | 512 KB | Execution killed with signal 11 |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 512 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 1 ms | 384 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Correct | 1 ms | 384 KB | Output is correct |
12 | Correct | 2 ms | 384 KB | Output is correct |
13 | Correct | 1 ms | 384 KB | Output is correct |
14 | Correct | 2 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 384 KB | Output is correct |
16 | Correct | 2 ms | 384 KB | Output is correct |
17 | Correct | 1 ms | 384 KB | Output is correct |
18 | Correct | 1 ms | 384 KB | Output is correct |
19 | Correct | 3 ms | 384 KB | Output is correct |
20 | Correct | 1 ms | 384 KB | Output is correct |
21 | Correct | 1 ms | 384 KB | Output is correct |
22 | Correct | 1 ms | 384 KB | Output is correct |
23 | Correct | 1 ms | 384 KB | Output is correct |
24 | Correct | 1 ms | 384 KB | Output is correct |
25 | Correct | 2 ms | 384 KB | Output is correct |
26 | Correct | 1 ms | 384 KB | Output is correct |
27 | Correct | 1 ms | 384 KB | Output is correct |
28 | Correct | 1 ms | 384 KB | Output is correct |
29 | Runtime error | 1 ms | 512 KB | Execution killed with signal 11 |
30 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 512 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 1 ms | 384 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Correct | 1 ms | 384 KB | Output is correct |
12 | Correct | 2 ms | 384 KB | Output is correct |
13 | Correct | 1 ms | 384 KB | Output is correct |
14 | Correct | 2 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 384 KB | Output is correct |
16 | Correct | 2 ms | 384 KB | Output is correct |
17 | Correct | 1 ms | 384 KB | Output is correct |
18 | Correct | 1 ms | 384 KB | Output is correct |
19 | Correct | 3 ms | 384 KB | Output is correct |
20 | Correct | 1 ms | 384 KB | Output is correct |
21 | Correct | 1 ms | 384 KB | Output is correct |
22 | Correct | 1 ms | 384 KB | Output is correct |
23 | Correct | 1 ms | 384 KB | Output is correct |
24 | Correct | 1 ms | 384 KB | Output is correct |
25 | Correct | 2 ms | 384 KB | Output is correct |
26 | Correct | 1 ms | 384 KB | Output is correct |
27 | Correct | 1 ms | 384 KB | Output is correct |
28 | Correct | 1 ms | 384 KB | Output is correct |
29 | Correct | 83 ms | 504 KB | Output is correct |
30 | Correct | 57 ms | 512 KB | Output is correct |
31 | Correct | 42 ms | 512 KB | Output is correct |
32 | Correct | 21 ms | 512 KB | Output is correct |
33 | Correct | 10 ms | 512 KB | Output is correct |
34 | Correct | 41 ms | 512 KB | Output is correct |
35 | Correct | 60 ms | 512 KB | Output is correct |
36 | Correct | 18 ms | 512 KB | Output is correct |
37 | Correct | 65 ms | 512 KB | Output is correct |
38 | Correct | 79 ms | 512 KB | Output is correct |
39 | Correct | 52 ms | 512 KB | Output is correct |
40 | Correct | 25 ms | 512 KB | Output is correct |
41 | Correct | 25 ms | 512 KB | Output is correct |
42 | Correct | 27 ms | 512 KB | Output is correct |
43 | Correct | 9 ms | 512 KB | Output is correct |
44 | Correct | 7 ms | 512 KB | Output is correct |
45 | Correct | 10 ms | 544 KB | Output is correct |
46 | Correct | 14 ms | 512 KB | Output is correct |
47 | Correct | 27 ms | 512 KB | Output is correct |
48 | Correct | 30 ms | 512 KB | Output is correct |
49 | Correct | 38 ms | 528 KB | Output is correct |
50 | Correct | 48 ms | 524 KB | Output is correct |
51 | Correct | 28 ms | 512 KB | Output is correct |
52 | Correct | 36 ms | 512 KB | Output is correct |
53 | Correct | 42 ms | 632 KB | Output is correct |
54 | Correct | 57 ms | 512 KB | Output is correct |
55 | Runtime error | 2 ms | 512 KB | Execution killed with signal 11 |
56 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 512 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 1 ms | 384 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Correct | 1 ms | 384 KB | Output is correct |
12 | Correct | 2 ms | 384 KB | Output is correct |
13 | Correct | 1 ms | 384 KB | Output is correct |
14 | Correct | 2 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 384 KB | Output is correct |
16 | Correct | 2 ms | 384 KB | Output is correct |
17 | Correct | 1 ms | 384 KB | Output is correct |
18 | Correct | 1 ms | 384 KB | Output is correct |
19 | Correct | 3 ms | 384 KB | Output is correct |
20 | Correct | 1 ms | 384 KB | Output is correct |
21 | Correct | 1 ms | 384 KB | Output is correct |
22 | Correct | 1 ms | 384 KB | Output is correct |
23 | Correct | 1 ms | 384 KB | Output is correct |
24 | Correct | 1 ms | 384 KB | Output is correct |
25 | Correct | 2 ms | 384 KB | Output is correct |
26 | Correct | 1 ms | 384 KB | Output is correct |
27 | Correct | 1 ms | 384 KB | Output is correct |
28 | Correct | 1 ms | 384 KB | Output is correct |
29 | Correct | 83 ms | 504 KB | Output is correct |
30 | Correct | 57 ms | 512 KB | Output is correct |
31 | Correct | 42 ms | 512 KB | Output is correct |
32 | Correct | 21 ms | 512 KB | Output is correct |
33 | Correct | 10 ms | 512 KB | Output is correct |
34 | Correct | 41 ms | 512 KB | Output is correct |
35 | Correct | 60 ms | 512 KB | Output is correct |
36 | Correct | 18 ms | 512 KB | Output is correct |
37 | Correct | 65 ms | 512 KB | Output is correct |
38 | Correct | 79 ms | 512 KB | Output is correct |
39 | Correct | 52 ms | 512 KB | Output is correct |
40 | Correct | 25 ms | 512 KB | Output is correct |
41 | Correct | 25 ms | 512 KB | Output is correct |
42 | Correct | 27 ms | 512 KB | Output is correct |
43 | Correct | 9 ms | 512 KB | Output is correct |
44 | Correct | 7 ms | 512 KB | Output is correct |
45 | Correct | 10 ms | 544 KB | Output is correct |
46 | Correct | 14 ms | 512 KB | Output is correct |
47 | Correct | 27 ms | 512 KB | Output is correct |
48 | Correct | 30 ms | 512 KB | Output is correct |
49 | Correct | 38 ms | 528 KB | Output is correct |
50 | Correct | 48 ms | 524 KB | Output is correct |
51 | Correct | 28 ms | 512 KB | Output is correct |
52 | Correct | 36 ms | 512 KB | Output is correct |
53 | Correct | 42 ms | 632 KB | Output is correct |
54 | Correct | 57 ms | 512 KB | Output is correct |
55 | Runtime error | 1 ms | 512 KB | Execution killed with signal 11 |
56 | Halted | 0 ms | 0 KB | - |