Submission #759300

# Submission time Handle Problem Language Result Execution time Memory
759300 2023-06-16T05:13:11 Z boyliguanhan Joker (BOI20_joker) C++17
14 / 100
2000 ms 14812 KB
#include<bits/stdc++.h>
#pragma GCC optimize(2)
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 2 ms 5716 KB Output is correct
2 Correct 3 ms 5716 KB Output is correct
3 Correct 3 ms 5716 KB Output is correct
4 Correct 3 ms 5716 KB Output is correct
5 Correct 3 ms 5716 KB Output is correct
6 Correct 3 ms 5716 KB Output is correct
7 Correct 5 ms 5716 KB Output is correct
8 Correct 5 ms 5716 KB Output is correct
9 Correct 5 ms 5716 KB Output is correct
10 Correct 5 ms 5716 KB Output is correct
11 Correct 5 ms 5816 KB Output is correct
12 Correct 5 ms 5716 KB Output is correct
13 Correct 5 ms 5716 KB Output is correct
14 Correct 6 ms 5716 KB Output is correct
15 Correct 5 ms 5716 KB Output is correct
16 Correct 5 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 5 ms 5716 KB Output is correct
21 Correct 5 ms 5716 KB Output is correct
22 Correct 6 ms 5824 KB Output is correct
23 Correct 5 ms 5816 KB Output is correct
24 Correct 5 ms 5716 KB Output is correct
25 Correct 5 ms 5716 KB Output is correct
26 Correct 6 ms 5824 KB Output is correct
27 Correct 5 ms 5716 KB Output is correct
28 Correct 6 ms 5816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 5716 KB Output is correct
2 Correct 3 ms 5716 KB Output is correct
3 Correct 3 ms 5716 KB Output is correct
4 Correct 3 ms 5716 KB Output is correct
5 Correct 3 ms 5716 KB Output is correct
6 Correct 3 ms 5716 KB Output is correct
7 Correct 5 ms 5716 KB Output is correct
8 Correct 5 ms 5716 KB Output is correct
9 Correct 5 ms 5716 KB Output is correct
10 Correct 5 ms 5716 KB Output is correct
11 Correct 5 ms 5816 KB Output is correct
12 Correct 5 ms 5716 KB Output is correct
13 Correct 5 ms 5716 KB Output is correct
14 Correct 6 ms 5716 KB Output is correct
15 Correct 5 ms 5716 KB Output is correct
16 Correct 5 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 5 ms 5716 KB Output is correct
21 Correct 5 ms 5716 KB Output is correct
22 Correct 6 ms 5824 KB Output is correct
23 Correct 5 ms 5816 KB Output is correct
24 Correct 5 ms 5716 KB Output is correct
25 Correct 5 ms 5716 KB Output is correct
26 Correct 6 ms 5824 KB Output is correct
27 Correct 5 ms 5716 KB Output is correct
28 Correct 6 ms 5816 KB Output is correct
29 Correct 67 ms 5844 KB Output is correct
30 Correct 71 ms 5888 KB Output is correct
31 Correct 60 ms 5884 KB Output is correct
32 Correct 46 ms 5844 KB Output is correct
33 Correct 38 ms 5876 KB Output is correct
34 Correct 64 ms 5896 KB Output is correct
35 Correct 75 ms 5876 KB Output is correct
36 Correct 48 ms 5844 KB Output is correct
37 Correct 83 ms 5844 KB Output is correct
38 Correct 79 ms 5900 KB Output is correct
39 Correct 67 ms 5892 KB Output is correct
40 Correct 50 ms 5844 KB Output is correct
41 Correct 48 ms 5844 KB Output is correct
42 Correct 48 ms 5880 KB Output is correct
43 Correct 45 ms 5884 KB Output is correct
44 Correct 43 ms 5880 KB Output is correct
45 Correct 46 ms 5844 KB Output is correct
46 Correct 51 ms 5892 KB Output is correct
47 Correct 48 ms 5844 KB Output is correct
48 Correct 52 ms 5876 KB Output is correct
49 Correct 65 ms 5972 KB Output is correct
50 Correct 70 ms 5892 KB Output is correct
51 Correct 47 ms 5888 KB Output is correct
52 Correct 51 ms 5868 KB Output is correct
53 Correct 57 ms 5844 KB Output is correct
54 Correct 73 ms 5896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 5716 KB Output is correct
2 Correct 3 ms 5716 KB Output is correct
3 Execution timed out 2086 ms 13684 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 5716 KB Output is correct
2 Correct 3 ms 5716 KB Output is correct
3 Correct 3 ms 5716 KB Output is correct
4 Correct 3 ms 5716 KB Output is correct
5 Correct 3 ms 5716 KB Output is correct
6 Correct 3 ms 5716 KB Output is correct
7 Correct 5 ms 5716 KB Output is correct
8 Correct 5 ms 5716 KB Output is correct
9 Correct 5 ms 5716 KB Output is correct
10 Correct 5 ms 5716 KB Output is correct
11 Correct 5 ms 5816 KB Output is correct
12 Correct 5 ms 5716 KB Output is correct
13 Correct 5 ms 5716 KB Output is correct
14 Correct 6 ms 5716 KB Output is correct
15 Correct 5 ms 5716 KB Output is correct
16 Correct 5 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 5 ms 5716 KB Output is correct
21 Correct 5 ms 5716 KB Output is correct
22 Correct 6 ms 5824 KB Output is correct
23 Correct 5 ms 5816 KB Output is correct
24 Correct 5 ms 5716 KB Output is correct
25 Correct 5 ms 5716 KB Output is correct
26 Correct 6 ms 5824 KB Output is correct
27 Correct 5 ms 5716 KB Output is correct
28 Correct 6 ms 5816 KB Output is correct
29 Execution timed out 2086 ms 13684 KB Time limit exceeded
30 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 5716 KB Output is correct
2 Correct 3 ms 5716 KB Output is correct
3 Correct 3 ms 5716 KB Output is correct
4 Correct 3 ms 5716 KB Output is correct
5 Correct 3 ms 5716 KB Output is correct
6 Correct 3 ms 5716 KB Output is correct
7 Correct 5 ms 5716 KB Output is correct
8 Correct 5 ms 5716 KB Output is correct
9 Correct 5 ms 5716 KB Output is correct
10 Correct 5 ms 5716 KB Output is correct
11 Correct 5 ms 5816 KB Output is correct
12 Correct 5 ms 5716 KB Output is correct
13 Correct 5 ms 5716 KB Output is correct
14 Correct 6 ms 5716 KB Output is correct
15 Correct 5 ms 5716 KB Output is correct
16 Correct 5 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 5 ms 5716 KB Output is correct
21 Correct 5 ms 5716 KB Output is correct
22 Correct 6 ms 5824 KB Output is correct
23 Correct 5 ms 5816 KB Output is correct
24 Correct 5 ms 5716 KB Output is correct
25 Correct 5 ms 5716 KB Output is correct
26 Correct 6 ms 5824 KB Output is correct
27 Correct 5 ms 5716 KB Output is correct
28 Correct 6 ms 5816 KB Output is correct
29 Correct 67 ms 5844 KB Output is correct
30 Correct 71 ms 5888 KB Output is correct
31 Correct 60 ms 5884 KB Output is correct
32 Correct 46 ms 5844 KB Output is correct
33 Correct 38 ms 5876 KB Output is correct
34 Correct 64 ms 5896 KB Output is correct
35 Correct 75 ms 5876 KB Output is correct
36 Correct 48 ms 5844 KB Output is correct
37 Correct 83 ms 5844 KB Output is correct
38 Correct 79 ms 5900 KB Output is correct
39 Correct 67 ms 5892 KB Output is correct
40 Correct 50 ms 5844 KB Output is correct
41 Correct 48 ms 5844 KB Output is correct
42 Correct 48 ms 5880 KB Output is correct
43 Correct 45 ms 5884 KB Output is correct
44 Correct 43 ms 5880 KB Output is correct
45 Correct 46 ms 5844 KB Output is correct
46 Correct 51 ms 5892 KB Output is correct
47 Correct 48 ms 5844 KB Output is correct
48 Correct 52 ms 5876 KB Output is correct
49 Correct 65 ms 5972 KB Output is correct
50 Correct 70 ms 5892 KB Output is correct
51 Correct 47 ms 5888 KB Output is correct
52 Correct 51 ms 5868 KB Output is correct
53 Correct 57 ms 5844 KB Output is correct
54 Correct 73 ms 5896 KB Output is correct
55 Execution timed out 2055 ms 14812 KB Time limit exceeded
56 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 5716 KB Output is correct
2 Correct 3 ms 5716 KB Output is correct
3 Correct 3 ms 5716 KB Output is correct
4 Correct 3 ms 5716 KB Output is correct
5 Correct 3 ms 5716 KB Output is correct
6 Correct 3 ms 5716 KB Output is correct
7 Correct 5 ms 5716 KB Output is correct
8 Correct 5 ms 5716 KB Output is correct
9 Correct 5 ms 5716 KB Output is correct
10 Correct 5 ms 5716 KB Output is correct
11 Correct 5 ms 5816 KB Output is correct
12 Correct 5 ms 5716 KB Output is correct
13 Correct 5 ms 5716 KB Output is correct
14 Correct 6 ms 5716 KB Output is correct
15 Correct 5 ms 5716 KB Output is correct
16 Correct 5 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 5 ms 5716 KB Output is correct
21 Correct 5 ms 5716 KB Output is correct
22 Correct 6 ms 5824 KB Output is correct
23 Correct 5 ms 5816 KB Output is correct
24 Correct 5 ms 5716 KB Output is correct
25 Correct 5 ms 5716 KB Output is correct
26 Correct 6 ms 5824 KB Output is correct
27 Correct 5 ms 5716 KB Output is correct
28 Correct 6 ms 5816 KB Output is correct
29 Correct 67 ms 5844 KB Output is correct
30 Correct 71 ms 5888 KB Output is correct
31 Correct 60 ms 5884 KB Output is correct
32 Correct 46 ms 5844 KB Output is correct
33 Correct 38 ms 5876 KB Output is correct
34 Correct 64 ms 5896 KB Output is correct
35 Correct 75 ms 5876 KB Output is correct
36 Correct 48 ms 5844 KB Output is correct
37 Correct 83 ms 5844 KB Output is correct
38 Correct 79 ms 5900 KB Output is correct
39 Correct 67 ms 5892 KB Output is correct
40 Correct 50 ms 5844 KB Output is correct
41 Correct 48 ms 5844 KB Output is correct
42 Correct 48 ms 5880 KB Output is correct
43 Correct 45 ms 5884 KB Output is correct
44 Correct 43 ms 5880 KB Output is correct
45 Correct 46 ms 5844 KB Output is correct
46 Correct 51 ms 5892 KB Output is correct
47 Correct 48 ms 5844 KB Output is correct
48 Correct 52 ms 5876 KB Output is correct
49 Correct 65 ms 5972 KB Output is correct
50 Correct 70 ms 5892 KB Output is correct
51 Correct 47 ms 5888 KB Output is correct
52 Correct 51 ms 5868 KB Output is correct
53 Correct 57 ms 5844 KB Output is correct
54 Correct 73 ms 5896 KB Output is correct
55 Execution timed out 2086 ms 13684 KB Time limit exceeded
56 Halted 0 ms 0 KB -