Submission #759299

# Submission time Handle Problem Language Result Execution time Memory
759299 2023-06-16T05:12:13 Z boyliguanhan Joker (BOI20_joker) C++17
14 / 100
2000 ms 17152 KB
#include<bits/stdc++.h>
using namespace std;
#define N 200100
vector<int> adj[N];
int color[N];
int dfs(int x, int col) {
    if(color[x]) {
        if(col==color[x]) return 0;
        else return 1;
    }
    color[x] = col;
    for(auto i: adj[x])
        if(dfs(i, 3-col))
            return 1;
    return 0;
}
int a[N], b[N];
int main() {
    cin.sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m, q;
    cin >> n >> m >> q;
    for(int i = 0; i < m; i++)
        cin >> a[i] >> b[i];
    while(q--) {
        int l, r;
        cin >> l >> r;
        memset(color, 0, sizeof color);
        for(int i = 1; i <= n; i++)
            adj[i].clear();
        for(int i = 0; i < l-1; i++)
            adj[a[i]].push_back(b[i]), adj[b[i]].push_back(a[i]);
        for(int i = r; i < m; i++)
            adj[a[i]].push_back(b[i]), adj[b[i]].push_back(a[i]);
        for(int i = 0; i < n; i++) {
            if(!color[i]){
                if(dfs(i, 1)) {
                    cout << "YES\n";
                    break;
                }
            }
            if(i==n-1) cout << "NO\n";
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 5716 KB Output is correct
2 Correct 3 ms 5716 KB Output is correct
3 Correct 3 ms 5792 KB Output is correct
4 Correct 3 ms 5716 KB Output is correct
5 Correct 3 ms 5796 KB Output is correct
6 Correct 3 ms 5796 KB Output is correct
7 Correct 5 ms 5792 KB Output is correct
8 Correct 5 ms 5716 KB Output is correct
9 Correct 5 ms 5716 KB Output is correct
10 Correct 6 ms 5788 KB Output is correct
11 Correct 5 ms 5716 KB Output is correct
12 Correct 6 ms 5800 KB Output is correct
13 Correct 6 ms 5800 KB Output is correct
14 Correct 8 ms 5848 KB Output is correct
15 Correct 6 ms 5716 KB Output is correct
16 Correct 6 ms 5716 KB Output is correct
17 Correct 5 ms 5716 KB Output is correct
18 Correct 5 ms 5716 KB Output is correct
19 Correct 5 ms 5716 KB Output is correct
20 Correct 6 ms 5716 KB Output is correct
21 Correct 6 ms 5716 KB Output is correct
22 Correct 6 ms 5780 KB Output is correct
23 Correct 6 ms 5796 KB Output is correct
24 Correct 5 ms 5716 KB Output is correct
25 Correct 5 ms 5720 KB Output is correct
26 Correct 5 ms 5792 KB Output is correct
27 Correct 6 ms 5716 KB Output is correct
28 Correct 6 ms 5800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 5716 KB Output is correct
2 Correct 3 ms 5716 KB Output is correct
3 Correct 3 ms 5792 KB Output is correct
4 Correct 3 ms 5716 KB Output is correct
5 Correct 3 ms 5796 KB Output is correct
6 Correct 3 ms 5796 KB Output is correct
7 Correct 5 ms 5792 KB Output is correct
8 Correct 5 ms 5716 KB Output is correct
9 Correct 5 ms 5716 KB Output is correct
10 Correct 6 ms 5788 KB Output is correct
11 Correct 5 ms 5716 KB Output is correct
12 Correct 6 ms 5800 KB Output is correct
13 Correct 6 ms 5800 KB Output is correct
14 Correct 8 ms 5848 KB Output is correct
15 Correct 6 ms 5716 KB Output is correct
16 Correct 6 ms 5716 KB Output is correct
17 Correct 5 ms 5716 KB Output is correct
18 Correct 5 ms 5716 KB Output is correct
19 Correct 5 ms 5716 KB Output is correct
20 Correct 6 ms 5716 KB Output is correct
21 Correct 6 ms 5716 KB Output is correct
22 Correct 6 ms 5780 KB Output is correct
23 Correct 6 ms 5796 KB Output is correct
24 Correct 5 ms 5716 KB Output is correct
25 Correct 5 ms 5720 KB Output is correct
26 Correct 5 ms 5792 KB Output is correct
27 Correct 6 ms 5716 KB Output is correct
28 Correct 6 ms 5800 KB Output is correct
29 Correct 71 ms 5804 KB Output is correct
30 Correct 75 ms 5916 KB Output is correct
31 Correct 63 ms 5924 KB Output is correct
32 Correct 46 ms 5900 KB Output is correct
33 Correct 43 ms 5844 KB Output is correct
34 Correct 65 ms 5912 KB Output is correct
35 Correct 84 ms 5912 KB Output is correct
36 Correct 48 ms 5844 KB Output is correct
37 Correct 83 ms 5936 KB Output is correct
38 Correct 80 ms 5844 KB Output is correct
39 Correct 73 ms 5916 KB Output is correct
40 Correct 52 ms 5920 KB Output is correct
41 Correct 49 ms 5916 KB Output is correct
42 Correct 49 ms 5900 KB Output is correct
43 Correct 42 ms 5904 KB Output is correct
44 Correct 43 ms 5844 KB Output is correct
45 Correct 47 ms 5920 KB Output is correct
46 Correct 52 ms 5912 KB Output is correct
47 Correct 49 ms 5908 KB Output is correct
48 Correct 52 ms 5908 KB Output is correct
49 Correct 59 ms 5908 KB Output is correct
50 Correct 71 ms 5972 KB Output is correct
51 Correct 46 ms 5908 KB Output is correct
52 Correct 57 ms 5900 KB Output is correct
53 Correct 62 ms 5908 KB Output is correct
54 Correct 72 ms 5924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 5716 KB Output is correct
2 Correct 3 ms 5716 KB Output is correct
3 Execution timed out 2043 ms 16240 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 5716 KB Output is correct
2 Correct 3 ms 5716 KB Output is correct
3 Correct 3 ms 5792 KB Output is correct
4 Correct 3 ms 5716 KB Output is correct
5 Correct 3 ms 5796 KB Output is correct
6 Correct 3 ms 5796 KB Output is correct
7 Correct 5 ms 5792 KB Output is correct
8 Correct 5 ms 5716 KB Output is correct
9 Correct 5 ms 5716 KB Output is correct
10 Correct 6 ms 5788 KB Output is correct
11 Correct 5 ms 5716 KB Output is correct
12 Correct 6 ms 5800 KB Output is correct
13 Correct 6 ms 5800 KB Output is correct
14 Correct 8 ms 5848 KB Output is correct
15 Correct 6 ms 5716 KB Output is correct
16 Correct 6 ms 5716 KB Output is correct
17 Correct 5 ms 5716 KB Output is correct
18 Correct 5 ms 5716 KB Output is correct
19 Correct 5 ms 5716 KB Output is correct
20 Correct 6 ms 5716 KB Output is correct
21 Correct 6 ms 5716 KB Output is correct
22 Correct 6 ms 5780 KB Output is correct
23 Correct 6 ms 5796 KB Output is correct
24 Correct 5 ms 5716 KB Output is correct
25 Correct 5 ms 5720 KB Output is correct
26 Correct 5 ms 5792 KB Output is correct
27 Correct 6 ms 5716 KB Output is correct
28 Correct 6 ms 5800 KB Output is correct
29 Execution timed out 2043 ms 16240 KB Time limit exceeded
30 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 5716 KB Output is correct
2 Correct 3 ms 5716 KB Output is correct
3 Correct 3 ms 5792 KB Output is correct
4 Correct 3 ms 5716 KB Output is correct
5 Correct 3 ms 5796 KB Output is correct
6 Correct 3 ms 5796 KB Output is correct
7 Correct 5 ms 5792 KB Output is correct
8 Correct 5 ms 5716 KB Output is correct
9 Correct 5 ms 5716 KB Output is correct
10 Correct 6 ms 5788 KB Output is correct
11 Correct 5 ms 5716 KB Output is correct
12 Correct 6 ms 5800 KB Output is correct
13 Correct 6 ms 5800 KB Output is correct
14 Correct 8 ms 5848 KB Output is correct
15 Correct 6 ms 5716 KB Output is correct
16 Correct 6 ms 5716 KB Output is correct
17 Correct 5 ms 5716 KB Output is correct
18 Correct 5 ms 5716 KB Output is correct
19 Correct 5 ms 5716 KB Output is correct
20 Correct 6 ms 5716 KB Output is correct
21 Correct 6 ms 5716 KB Output is correct
22 Correct 6 ms 5780 KB Output is correct
23 Correct 6 ms 5796 KB Output is correct
24 Correct 5 ms 5716 KB Output is correct
25 Correct 5 ms 5720 KB Output is correct
26 Correct 5 ms 5792 KB Output is correct
27 Correct 6 ms 5716 KB Output is correct
28 Correct 6 ms 5800 KB Output is correct
29 Correct 71 ms 5804 KB Output is correct
30 Correct 75 ms 5916 KB Output is correct
31 Correct 63 ms 5924 KB Output is correct
32 Correct 46 ms 5900 KB Output is correct
33 Correct 43 ms 5844 KB Output is correct
34 Correct 65 ms 5912 KB Output is correct
35 Correct 84 ms 5912 KB Output is correct
36 Correct 48 ms 5844 KB Output is correct
37 Correct 83 ms 5936 KB Output is correct
38 Correct 80 ms 5844 KB Output is correct
39 Correct 73 ms 5916 KB Output is correct
40 Correct 52 ms 5920 KB Output is correct
41 Correct 49 ms 5916 KB Output is correct
42 Correct 49 ms 5900 KB Output is correct
43 Correct 42 ms 5904 KB Output is correct
44 Correct 43 ms 5844 KB Output is correct
45 Correct 47 ms 5920 KB Output is correct
46 Correct 52 ms 5912 KB Output is correct
47 Correct 49 ms 5908 KB Output is correct
48 Correct 52 ms 5908 KB Output is correct
49 Correct 59 ms 5908 KB Output is correct
50 Correct 71 ms 5972 KB Output is correct
51 Correct 46 ms 5908 KB Output is correct
52 Correct 57 ms 5900 KB Output is correct
53 Correct 62 ms 5908 KB Output is correct
54 Correct 72 ms 5924 KB Output is correct
55 Execution timed out 2056 ms 17152 KB Time limit exceeded
56 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 5716 KB Output is correct
2 Correct 3 ms 5716 KB Output is correct
3 Correct 3 ms 5792 KB Output is correct
4 Correct 3 ms 5716 KB Output is correct
5 Correct 3 ms 5796 KB Output is correct
6 Correct 3 ms 5796 KB Output is correct
7 Correct 5 ms 5792 KB Output is correct
8 Correct 5 ms 5716 KB Output is correct
9 Correct 5 ms 5716 KB Output is correct
10 Correct 6 ms 5788 KB Output is correct
11 Correct 5 ms 5716 KB Output is correct
12 Correct 6 ms 5800 KB Output is correct
13 Correct 6 ms 5800 KB Output is correct
14 Correct 8 ms 5848 KB Output is correct
15 Correct 6 ms 5716 KB Output is correct
16 Correct 6 ms 5716 KB Output is correct
17 Correct 5 ms 5716 KB Output is correct
18 Correct 5 ms 5716 KB Output is correct
19 Correct 5 ms 5716 KB Output is correct
20 Correct 6 ms 5716 KB Output is correct
21 Correct 6 ms 5716 KB Output is correct
22 Correct 6 ms 5780 KB Output is correct
23 Correct 6 ms 5796 KB Output is correct
24 Correct 5 ms 5716 KB Output is correct
25 Correct 5 ms 5720 KB Output is correct
26 Correct 5 ms 5792 KB Output is correct
27 Correct 6 ms 5716 KB Output is correct
28 Correct 6 ms 5800 KB Output is correct
29 Correct 71 ms 5804 KB Output is correct
30 Correct 75 ms 5916 KB Output is correct
31 Correct 63 ms 5924 KB Output is correct
32 Correct 46 ms 5900 KB Output is correct
33 Correct 43 ms 5844 KB Output is correct
34 Correct 65 ms 5912 KB Output is correct
35 Correct 84 ms 5912 KB Output is correct
36 Correct 48 ms 5844 KB Output is correct
37 Correct 83 ms 5936 KB Output is correct
38 Correct 80 ms 5844 KB Output is correct
39 Correct 73 ms 5916 KB Output is correct
40 Correct 52 ms 5920 KB Output is correct
41 Correct 49 ms 5916 KB Output is correct
42 Correct 49 ms 5900 KB Output is correct
43 Correct 42 ms 5904 KB Output is correct
44 Correct 43 ms 5844 KB Output is correct
45 Correct 47 ms 5920 KB Output is correct
46 Correct 52 ms 5912 KB Output is correct
47 Correct 49 ms 5908 KB Output is correct
48 Correct 52 ms 5908 KB Output is correct
49 Correct 59 ms 5908 KB Output is correct
50 Correct 71 ms 5972 KB Output is correct
51 Correct 46 ms 5908 KB Output is correct
52 Correct 57 ms 5900 KB Output is correct
53 Correct 62 ms 5908 KB Output is correct
54 Correct 72 ms 5924 KB Output is correct
55 Execution timed out 2043 ms 16240 KB Time limit exceeded
56 Halted 0 ms 0 KB -