# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
255915 | 2020-08-02T05:41:17 Z | 반딧불(#5032) | Joker (BOI20_joker) | C++17 | 2000 ms | 14516 KB |
#include <bits/stdc++.h> #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") using namespace std; typedef long long ll; struct dat{ int s, e, i; dat(){} dat(int s, int e, int i): s(s), e(e), i(i){} }; vector<dat> link[200002]; int n, m, q; int l, r; int chk[200002]; bool dfs(int x, int y = 1){ chk[x] = y; for(auto &nxt: link[x]){ if(l <= nxt.i && nxt.i <= r) continue; if(chk[nxt.e] == y) return true; if(chk[nxt.e] == 0 && dfs(nxt.e, 3-y)) return true; } return false; } int main(){ scanf("%d %d %d", &n, &m, &q); for(int i=1; i<=m; i++){ int s, e; scanf("%d %d", &s, &e); link[s].push_back(dat(s, e, i)); link[e].push_back(dat(e, s, i)); } while(q--){ scanf("%d %d", &l, &r); memset(chk, 0, sizeof(chk)); bool possible = 0; for(int i=1; i<=n; i++){ if(!chk[i] && dfs(i)){ possible = 1; break; } } printf("%s\n", possible ? "YES" : "NO"); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 5760 KB | Output is correct |
2 | Correct | 3 ms | 5760 KB | Output is correct |
3 | Correct | 4 ms | 5760 KB | Output is correct |
4 | Correct | 4 ms | 5760 KB | Output is correct |
5 | Correct | 5 ms | 5760 KB | Output is correct |
6 | Correct | 4 ms | 5760 KB | Output is correct |
7 | Correct | 9 ms | 5760 KB | Output is correct |
8 | Correct | 9 ms | 5760 KB | Output is correct |
9 | Correct | 8 ms | 5760 KB | Output is correct |
10 | Correct | 10 ms | 5760 KB | Output is correct |
11 | Correct | 9 ms | 5760 KB | Output is correct |
12 | Correct | 9 ms | 5760 KB | Output is correct |
13 | Correct | 9 ms | 5888 KB | Output is correct |
14 | Correct | 8 ms | 5760 KB | Output is correct |
15 | Correct | 9 ms | 5760 KB | Output is correct |
16 | Correct | 10 ms | 5760 KB | Output is correct |
17 | Correct | 8 ms | 5760 KB | Output is correct |
18 | Correct | 10 ms | 5760 KB | Output is correct |
19 | Correct | 13 ms | 5760 KB | Output is correct |
20 | Correct | 8 ms | 5760 KB | Output is correct |
21 | Correct | 10 ms | 5760 KB | Output is correct |
22 | Correct | 8 ms | 5760 KB | Output is correct |
23 | Correct | 8 ms | 5760 KB | Output is correct |
24 | Correct | 9 ms | 5760 KB | Output is correct |
25 | Correct | 10 ms | 5760 KB | Output is correct |
26 | Correct | 9 ms | 5760 KB | Output is correct |
27 | Correct | 10 ms | 5760 KB | Output is correct |
28 | Correct | 9 ms | 5760 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 5760 KB | Output is correct |
2 | Correct | 3 ms | 5760 KB | Output is correct |
3 | Correct | 4 ms | 5760 KB | Output is correct |
4 | Correct | 4 ms | 5760 KB | Output is correct |
5 | Correct | 5 ms | 5760 KB | Output is correct |
6 | Correct | 4 ms | 5760 KB | Output is correct |
7 | Correct | 9 ms | 5760 KB | Output is correct |
8 | Correct | 9 ms | 5760 KB | Output is correct |
9 | Correct | 8 ms | 5760 KB | Output is correct |
10 | Correct | 10 ms | 5760 KB | Output is correct |
11 | Correct | 9 ms | 5760 KB | Output is correct |
12 | Correct | 9 ms | 5760 KB | Output is correct |
13 | Correct | 9 ms | 5888 KB | Output is correct |
14 | Correct | 8 ms | 5760 KB | Output is correct |
15 | Correct | 9 ms | 5760 KB | Output is correct |
16 | Correct | 10 ms | 5760 KB | Output is correct |
17 | Correct | 8 ms | 5760 KB | Output is correct |
18 | Correct | 10 ms | 5760 KB | Output is correct |
19 | Correct | 13 ms | 5760 KB | Output is correct |
20 | Correct | 8 ms | 5760 KB | Output is correct |
21 | Correct | 10 ms | 5760 KB | Output is correct |
22 | Correct | 8 ms | 5760 KB | Output is correct |
23 | Correct | 8 ms | 5760 KB | Output is correct |
24 | Correct | 9 ms | 5760 KB | Output is correct |
25 | Correct | 10 ms | 5760 KB | Output is correct |
26 | Correct | 9 ms | 5760 KB | Output is correct |
27 | Correct | 10 ms | 5760 KB | Output is correct |
28 | Correct | 9 ms | 5760 KB | Output is correct |
29 | Correct | 117 ms | 5888 KB | Output is correct |
30 | Correct | 105 ms | 5888 KB | Output is correct |
31 | Correct | 92 ms | 5928 KB | Output is correct |
32 | Correct | 70 ms | 5888 KB | Output is correct |
33 | Correct | 59 ms | 5888 KB | Output is correct |
34 | Correct | 87 ms | 5932 KB | Output is correct |
35 | Correct | 108 ms | 6008 KB | Output is correct |
36 | Correct | 68 ms | 5888 KB | Output is correct |
37 | Correct | 113 ms | 5888 KB | Output is correct |
38 | Correct | 123 ms | 5928 KB | Output is correct |
39 | Correct | 106 ms | 5888 KB | Output is correct |
40 | Correct | 90 ms | 5888 KB | Output is correct |
41 | Correct | 88 ms | 5888 KB | Output is correct |
42 | Correct | 76 ms | 5940 KB | Output is correct |
43 | Correct | 58 ms | 5888 KB | Output is correct |
44 | Correct | 61 ms | 5888 KB | Output is correct |
45 | Correct | 58 ms | 5888 KB | Output is correct |
46 | Correct | 82 ms | 5888 KB | Output is correct |
47 | Correct | 78 ms | 5888 KB | Output is correct |
48 | Correct | 77 ms | 5888 KB | Output is correct |
49 | Correct | 86 ms | 5888 KB | Output is correct |
50 | Correct | 100 ms | 5920 KB | Output is correct |
51 | Correct | 75 ms | 5888 KB | Output is correct |
52 | Correct | 82 ms | 5888 KB | Output is correct |
53 | Correct | 93 ms | 5888 KB | Output is correct |
54 | Correct | 105 ms | 6008 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 5760 KB | Output is correct |
2 | Correct | 3 ms | 5760 KB | Output is correct |
3 | Execution timed out | 2099 ms | 13944 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 5760 KB | Output is correct |
2 | Correct | 3 ms | 5760 KB | Output is correct |
3 | Correct | 4 ms | 5760 KB | Output is correct |
4 | Correct | 4 ms | 5760 KB | Output is correct |
5 | Correct | 5 ms | 5760 KB | Output is correct |
6 | Correct | 4 ms | 5760 KB | Output is correct |
7 | Correct | 9 ms | 5760 KB | Output is correct |
8 | Correct | 9 ms | 5760 KB | Output is correct |
9 | Correct | 8 ms | 5760 KB | Output is correct |
10 | Correct | 10 ms | 5760 KB | Output is correct |
11 | Correct | 9 ms | 5760 KB | Output is correct |
12 | Correct | 9 ms | 5760 KB | Output is correct |
13 | Correct | 9 ms | 5888 KB | Output is correct |
14 | Correct | 8 ms | 5760 KB | Output is correct |
15 | Correct | 9 ms | 5760 KB | Output is correct |
16 | Correct | 10 ms | 5760 KB | Output is correct |
17 | Correct | 8 ms | 5760 KB | Output is correct |
18 | Correct | 10 ms | 5760 KB | Output is correct |
19 | Correct | 13 ms | 5760 KB | Output is correct |
20 | Correct | 8 ms | 5760 KB | Output is correct |
21 | Correct | 10 ms | 5760 KB | Output is correct |
22 | Correct | 8 ms | 5760 KB | Output is correct |
23 | Correct | 8 ms | 5760 KB | Output is correct |
24 | Correct | 9 ms | 5760 KB | Output is correct |
25 | Correct | 10 ms | 5760 KB | Output is correct |
26 | Correct | 9 ms | 5760 KB | Output is correct |
27 | Correct | 10 ms | 5760 KB | Output is correct |
28 | Correct | 9 ms | 5760 KB | Output is correct |
29 | Execution timed out | 2099 ms | 13944 KB | Time limit exceeded |
30 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 5760 KB | Output is correct |
2 | Correct | 3 ms | 5760 KB | Output is correct |
3 | Correct | 4 ms | 5760 KB | Output is correct |
4 | Correct | 4 ms | 5760 KB | Output is correct |
5 | Correct | 5 ms | 5760 KB | Output is correct |
6 | Correct | 4 ms | 5760 KB | Output is correct |
7 | Correct | 9 ms | 5760 KB | Output is correct |
8 | Correct | 9 ms | 5760 KB | Output is correct |
9 | Correct | 8 ms | 5760 KB | Output is correct |
10 | Correct | 10 ms | 5760 KB | Output is correct |
11 | Correct | 9 ms | 5760 KB | Output is correct |
12 | Correct | 9 ms | 5760 KB | Output is correct |
13 | Correct | 9 ms | 5888 KB | Output is correct |
14 | Correct | 8 ms | 5760 KB | Output is correct |
15 | Correct | 9 ms | 5760 KB | Output is correct |
16 | Correct | 10 ms | 5760 KB | Output is correct |
17 | Correct | 8 ms | 5760 KB | Output is correct |
18 | Correct | 10 ms | 5760 KB | Output is correct |
19 | Correct | 13 ms | 5760 KB | Output is correct |
20 | Correct | 8 ms | 5760 KB | Output is correct |
21 | Correct | 10 ms | 5760 KB | Output is correct |
22 | Correct | 8 ms | 5760 KB | Output is correct |
23 | Correct | 8 ms | 5760 KB | Output is correct |
24 | Correct | 9 ms | 5760 KB | Output is correct |
25 | Correct | 10 ms | 5760 KB | Output is correct |
26 | Correct | 9 ms | 5760 KB | Output is correct |
27 | Correct | 10 ms | 5760 KB | Output is correct |
28 | Correct | 9 ms | 5760 KB | Output is correct |
29 | Correct | 117 ms | 5888 KB | Output is correct |
30 | Correct | 105 ms | 5888 KB | Output is correct |
31 | Correct | 92 ms | 5928 KB | Output is correct |
32 | Correct | 70 ms | 5888 KB | Output is correct |
33 | Correct | 59 ms | 5888 KB | Output is correct |
34 | Correct | 87 ms | 5932 KB | Output is correct |
35 | Correct | 108 ms | 6008 KB | Output is correct |
36 | Correct | 68 ms | 5888 KB | Output is correct |
37 | Correct | 113 ms | 5888 KB | Output is correct |
38 | Correct | 123 ms | 5928 KB | Output is correct |
39 | Correct | 106 ms | 5888 KB | Output is correct |
40 | Correct | 90 ms | 5888 KB | Output is correct |
41 | Correct | 88 ms | 5888 KB | Output is correct |
42 | Correct | 76 ms | 5940 KB | Output is correct |
43 | Correct | 58 ms | 5888 KB | Output is correct |
44 | Correct | 61 ms | 5888 KB | Output is correct |
45 | Correct | 58 ms | 5888 KB | Output is correct |
46 | Correct | 82 ms | 5888 KB | Output is correct |
47 | Correct | 78 ms | 5888 KB | Output is correct |
48 | Correct | 77 ms | 5888 KB | Output is correct |
49 | Correct | 86 ms | 5888 KB | Output is correct |
50 | Correct | 100 ms | 5920 KB | Output is correct |
51 | Correct | 75 ms | 5888 KB | Output is correct |
52 | Correct | 82 ms | 5888 KB | Output is correct |
53 | Correct | 93 ms | 5888 KB | Output is correct |
54 | Correct | 105 ms | 6008 KB | Output is correct |
55 | Execution timed out | 2081 ms | 14516 KB | Time limit exceeded |
56 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 5760 KB | Output is correct |
2 | Correct | 3 ms | 5760 KB | Output is correct |
3 | Correct | 4 ms | 5760 KB | Output is correct |
4 | Correct | 4 ms | 5760 KB | Output is correct |
5 | Correct | 5 ms | 5760 KB | Output is correct |
6 | Correct | 4 ms | 5760 KB | Output is correct |
7 | Correct | 9 ms | 5760 KB | Output is correct |
8 | Correct | 9 ms | 5760 KB | Output is correct |
9 | Correct | 8 ms | 5760 KB | Output is correct |
10 | Correct | 10 ms | 5760 KB | Output is correct |
11 | Correct | 9 ms | 5760 KB | Output is correct |
12 | Correct | 9 ms | 5760 KB | Output is correct |
13 | Correct | 9 ms | 5888 KB | Output is correct |
14 | Correct | 8 ms | 5760 KB | Output is correct |
15 | Correct | 9 ms | 5760 KB | Output is correct |
16 | Correct | 10 ms | 5760 KB | Output is correct |
17 | Correct | 8 ms | 5760 KB | Output is correct |
18 | Correct | 10 ms | 5760 KB | Output is correct |
19 | Correct | 13 ms | 5760 KB | Output is correct |
20 | Correct | 8 ms | 5760 KB | Output is correct |
21 | Correct | 10 ms | 5760 KB | Output is correct |
22 | Correct | 8 ms | 5760 KB | Output is correct |
23 | Correct | 8 ms | 5760 KB | Output is correct |
24 | Correct | 9 ms | 5760 KB | Output is correct |
25 | Correct | 10 ms | 5760 KB | Output is correct |
26 | Correct | 9 ms | 5760 KB | Output is correct |
27 | Correct | 10 ms | 5760 KB | Output is correct |
28 | Correct | 9 ms | 5760 KB | Output is correct |
29 | Correct | 117 ms | 5888 KB | Output is correct |
30 | Correct | 105 ms | 5888 KB | Output is correct |
31 | Correct | 92 ms | 5928 KB | Output is correct |
32 | Correct | 70 ms | 5888 KB | Output is correct |
33 | Correct | 59 ms | 5888 KB | Output is correct |
34 | Correct | 87 ms | 5932 KB | Output is correct |
35 | Correct | 108 ms | 6008 KB | Output is correct |
36 | Correct | 68 ms | 5888 KB | Output is correct |
37 | Correct | 113 ms | 5888 KB | Output is correct |
38 | Correct | 123 ms | 5928 KB | Output is correct |
39 | Correct | 106 ms | 5888 KB | Output is correct |
40 | Correct | 90 ms | 5888 KB | Output is correct |
41 | Correct | 88 ms | 5888 KB | Output is correct |
42 | Correct | 76 ms | 5940 KB | Output is correct |
43 | Correct | 58 ms | 5888 KB | Output is correct |
44 | Correct | 61 ms | 5888 KB | Output is correct |
45 | Correct | 58 ms | 5888 KB | Output is correct |
46 | Correct | 82 ms | 5888 KB | Output is correct |
47 | Correct | 78 ms | 5888 KB | Output is correct |
48 | Correct | 77 ms | 5888 KB | Output is correct |
49 | Correct | 86 ms | 5888 KB | Output is correct |
50 | Correct | 100 ms | 5920 KB | Output is correct |
51 | Correct | 75 ms | 5888 KB | Output is correct |
52 | Correct | 82 ms | 5888 KB | Output is correct |
53 | Correct | 93 ms | 5888 KB | Output is correct |
54 | Correct | 105 ms | 6008 KB | Output is correct |
55 | Execution timed out | 2099 ms | 13944 KB | Time limit exceeded |
56 | Halted | 0 ms | 0 KB | - |