Submission #930519

# Submission time Handle Problem Language Result Execution time Memory
930519 2024-02-20T05:26:08 Z Jawad_Akbar_JJ Joker (BOI20_joker) C++17
14 / 100
2000 ms 21492 KB
#include <iostream>
#include <vector>

using namespace std;
const int N = (1<<18) + 1;
vector<pair<int,int>> nei[N];
int seen[N],h[N];
int cur = 1,l,r;
bool odd;


void dfs(int u,int k = 1){
	seen[u] = cur;
	h[u] = k;
	for (auto [i,j] : nei[u]){
		if (j <= r and j >= l)
			continue;
		if (seen[i] == cur){
			if ((h[u] - h[i]) % 2 == 0)
				odd = true;
		}
		else
			dfs(i,k+1);
	}
}


signed  main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,m,q;
	cin>>n>>m>>q;

	for (int i=1;i<=m;i++){
		int a,b;
		cin>>a>>b;
		nei[a].push_back({b,i});
		nei[b].push_back({a,i});
	}

	while (q--){
		cin>>l>>r;
		odd = false;
		for (int i=1;i<=n;i++)
			if (seen[i]!=cur)
				dfs(i);
		cur++;
		if (odd)
			cout<<"YES"<<'\n';
		else
			cout<<"NO"<<'\n';
	}
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 8284 KB Output is correct
2 Correct 3 ms 8536 KB Output is correct
3 Correct 2 ms 8284 KB Output is correct
4 Correct 2 ms 8284 KB Output is correct
5 Correct 2 ms 8280 KB Output is correct
6 Correct 2 ms 8284 KB Output is correct
7 Correct 3 ms 8284 KB Output is correct
8 Correct 3 ms 8536 KB Output is correct
9 Correct 3 ms 8284 KB Output is correct
10 Correct 3 ms 8480 KB Output is correct
11 Correct 3 ms 8280 KB Output is correct
12 Correct 3 ms 8492 KB Output is correct
13 Correct 3 ms 8284 KB Output is correct
14 Correct 3 ms 8284 KB Output is correct
15 Correct 2 ms 8284 KB Output is correct
16 Correct 3 ms 8284 KB Output is correct
17 Correct 3 ms 8492 KB Output is correct
18 Correct 3 ms 8460 KB Output is correct
19 Correct 4 ms 8484 KB Output is correct
20 Correct 3 ms 8284 KB Output is correct
21 Correct 3 ms 8284 KB Output is correct
22 Correct 3 ms 8280 KB Output is correct
23 Correct 3 ms 8540 KB Output is correct
24 Correct 3 ms 8284 KB Output is correct
25 Correct 3 ms 8284 KB Output is correct
26 Correct 2 ms 8492 KB Output is correct
27 Correct 3 ms 8284 KB Output is correct
28 Correct 3 ms 8280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 8284 KB Output is correct
2 Correct 3 ms 8536 KB Output is correct
3 Correct 2 ms 8284 KB Output is correct
4 Correct 2 ms 8284 KB Output is correct
5 Correct 2 ms 8280 KB Output is correct
6 Correct 2 ms 8284 KB Output is correct
7 Correct 3 ms 8284 KB Output is correct
8 Correct 3 ms 8536 KB Output is correct
9 Correct 3 ms 8284 KB Output is correct
10 Correct 3 ms 8480 KB Output is correct
11 Correct 3 ms 8280 KB Output is correct
12 Correct 3 ms 8492 KB Output is correct
13 Correct 3 ms 8284 KB Output is correct
14 Correct 3 ms 8284 KB Output is correct
15 Correct 2 ms 8284 KB Output is correct
16 Correct 3 ms 8284 KB Output is correct
17 Correct 3 ms 8492 KB Output is correct
18 Correct 3 ms 8460 KB Output is correct
19 Correct 4 ms 8484 KB Output is correct
20 Correct 3 ms 8284 KB Output is correct
21 Correct 3 ms 8284 KB Output is correct
22 Correct 3 ms 8280 KB Output is correct
23 Correct 3 ms 8540 KB Output is correct
24 Correct 3 ms 8284 KB Output is correct
25 Correct 3 ms 8284 KB Output is correct
26 Correct 2 ms 8492 KB Output is correct
27 Correct 3 ms 8284 KB Output is correct
28 Correct 3 ms 8280 KB Output is correct
29 Correct 65 ms 8560 KB Output is correct
30 Correct 99 ms 8600 KB Output is correct
31 Correct 94 ms 8624 KB Output is correct
32 Correct 76 ms 8612 KB Output is correct
33 Correct 62 ms 8536 KB Output is correct
34 Correct 99 ms 8604 KB Output is correct
35 Correct 103 ms 8608 KB Output is correct
36 Correct 30 ms 8796 KB Output is correct
37 Correct 59 ms 8500 KB Output is correct
38 Correct 49 ms 8540 KB Output is correct
39 Correct 68 ms 8536 KB Output is correct
40 Correct 65 ms 8624 KB Output is correct
41 Correct 66 ms 8616 KB Output is correct
42 Correct 69 ms 8792 KB Output is correct
43 Correct 73 ms 8788 KB Output is correct
44 Correct 87 ms 8536 KB Output is correct
45 Correct 108 ms 8608 KB Output is correct
46 Correct 103 ms 8536 KB Output is correct
47 Correct 64 ms 8536 KB Output is correct
48 Correct 72 ms 8540 KB Output is correct
49 Correct 86 ms 8540 KB Output is correct
50 Correct 94 ms 8604 KB Output is correct
51 Correct 70 ms 8788 KB Output is correct
52 Correct 76 ms 8540 KB Output is correct
53 Correct 91 ms 8620 KB Output is correct
54 Correct 109 ms 8608 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 8284 KB Output is correct
2 Correct 3 ms 8536 KB Output is correct
3 Execution timed out 2086 ms 20180 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 8284 KB Output is correct
2 Correct 3 ms 8536 KB Output is correct
3 Correct 2 ms 8284 KB Output is correct
4 Correct 2 ms 8284 KB Output is correct
5 Correct 2 ms 8280 KB Output is correct
6 Correct 2 ms 8284 KB Output is correct
7 Correct 3 ms 8284 KB Output is correct
8 Correct 3 ms 8536 KB Output is correct
9 Correct 3 ms 8284 KB Output is correct
10 Correct 3 ms 8480 KB Output is correct
11 Correct 3 ms 8280 KB Output is correct
12 Correct 3 ms 8492 KB Output is correct
13 Correct 3 ms 8284 KB Output is correct
14 Correct 3 ms 8284 KB Output is correct
15 Correct 2 ms 8284 KB Output is correct
16 Correct 3 ms 8284 KB Output is correct
17 Correct 3 ms 8492 KB Output is correct
18 Correct 3 ms 8460 KB Output is correct
19 Correct 4 ms 8484 KB Output is correct
20 Correct 3 ms 8284 KB Output is correct
21 Correct 3 ms 8284 KB Output is correct
22 Correct 3 ms 8280 KB Output is correct
23 Correct 3 ms 8540 KB Output is correct
24 Correct 3 ms 8284 KB Output is correct
25 Correct 3 ms 8284 KB Output is correct
26 Correct 2 ms 8492 KB Output is correct
27 Correct 3 ms 8284 KB Output is correct
28 Correct 3 ms 8280 KB Output is correct
29 Execution timed out 2086 ms 20180 KB Time limit exceeded
30 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 8284 KB Output is correct
2 Correct 3 ms 8536 KB Output is correct
3 Correct 2 ms 8284 KB Output is correct
4 Correct 2 ms 8284 KB Output is correct
5 Correct 2 ms 8280 KB Output is correct
6 Correct 2 ms 8284 KB Output is correct
7 Correct 3 ms 8284 KB Output is correct
8 Correct 3 ms 8536 KB Output is correct
9 Correct 3 ms 8284 KB Output is correct
10 Correct 3 ms 8480 KB Output is correct
11 Correct 3 ms 8280 KB Output is correct
12 Correct 3 ms 8492 KB Output is correct
13 Correct 3 ms 8284 KB Output is correct
14 Correct 3 ms 8284 KB Output is correct
15 Correct 2 ms 8284 KB Output is correct
16 Correct 3 ms 8284 KB Output is correct
17 Correct 3 ms 8492 KB Output is correct
18 Correct 3 ms 8460 KB Output is correct
19 Correct 4 ms 8484 KB Output is correct
20 Correct 3 ms 8284 KB Output is correct
21 Correct 3 ms 8284 KB Output is correct
22 Correct 3 ms 8280 KB Output is correct
23 Correct 3 ms 8540 KB Output is correct
24 Correct 3 ms 8284 KB Output is correct
25 Correct 3 ms 8284 KB Output is correct
26 Correct 2 ms 8492 KB Output is correct
27 Correct 3 ms 8284 KB Output is correct
28 Correct 3 ms 8280 KB Output is correct
29 Correct 65 ms 8560 KB Output is correct
30 Correct 99 ms 8600 KB Output is correct
31 Correct 94 ms 8624 KB Output is correct
32 Correct 76 ms 8612 KB Output is correct
33 Correct 62 ms 8536 KB Output is correct
34 Correct 99 ms 8604 KB Output is correct
35 Correct 103 ms 8608 KB Output is correct
36 Correct 30 ms 8796 KB Output is correct
37 Correct 59 ms 8500 KB Output is correct
38 Correct 49 ms 8540 KB Output is correct
39 Correct 68 ms 8536 KB Output is correct
40 Correct 65 ms 8624 KB Output is correct
41 Correct 66 ms 8616 KB Output is correct
42 Correct 69 ms 8792 KB Output is correct
43 Correct 73 ms 8788 KB Output is correct
44 Correct 87 ms 8536 KB Output is correct
45 Correct 108 ms 8608 KB Output is correct
46 Correct 103 ms 8536 KB Output is correct
47 Correct 64 ms 8536 KB Output is correct
48 Correct 72 ms 8540 KB Output is correct
49 Correct 86 ms 8540 KB Output is correct
50 Correct 94 ms 8604 KB Output is correct
51 Correct 70 ms 8788 KB Output is correct
52 Correct 76 ms 8540 KB Output is correct
53 Correct 91 ms 8620 KB Output is correct
54 Correct 109 ms 8608 KB Output is correct
55 Execution timed out 2035 ms 21492 KB Time limit exceeded
56 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 8284 KB Output is correct
2 Correct 3 ms 8536 KB Output is correct
3 Correct 2 ms 8284 KB Output is correct
4 Correct 2 ms 8284 KB Output is correct
5 Correct 2 ms 8280 KB Output is correct
6 Correct 2 ms 8284 KB Output is correct
7 Correct 3 ms 8284 KB Output is correct
8 Correct 3 ms 8536 KB Output is correct
9 Correct 3 ms 8284 KB Output is correct
10 Correct 3 ms 8480 KB Output is correct
11 Correct 3 ms 8280 KB Output is correct
12 Correct 3 ms 8492 KB Output is correct
13 Correct 3 ms 8284 KB Output is correct
14 Correct 3 ms 8284 KB Output is correct
15 Correct 2 ms 8284 KB Output is correct
16 Correct 3 ms 8284 KB Output is correct
17 Correct 3 ms 8492 KB Output is correct
18 Correct 3 ms 8460 KB Output is correct
19 Correct 4 ms 8484 KB Output is correct
20 Correct 3 ms 8284 KB Output is correct
21 Correct 3 ms 8284 KB Output is correct
22 Correct 3 ms 8280 KB Output is correct
23 Correct 3 ms 8540 KB Output is correct
24 Correct 3 ms 8284 KB Output is correct
25 Correct 3 ms 8284 KB Output is correct
26 Correct 2 ms 8492 KB Output is correct
27 Correct 3 ms 8284 KB Output is correct
28 Correct 3 ms 8280 KB Output is correct
29 Correct 65 ms 8560 KB Output is correct
30 Correct 99 ms 8600 KB Output is correct
31 Correct 94 ms 8624 KB Output is correct
32 Correct 76 ms 8612 KB Output is correct
33 Correct 62 ms 8536 KB Output is correct
34 Correct 99 ms 8604 KB Output is correct
35 Correct 103 ms 8608 KB Output is correct
36 Correct 30 ms 8796 KB Output is correct
37 Correct 59 ms 8500 KB Output is correct
38 Correct 49 ms 8540 KB Output is correct
39 Correct 68 ms 8536 KB Output is correct
40 Correct 65 ms 8624 KB Output is correct
41 Correct 66 ms 8616 KB Output is correct
42 Correct 69 ms 8792 KB Output is correct
43 Correct 73 ms 8788 KB Output is correct
44 Correct 87 ms 8536 KB Output is correct
45 Correct 108 ms 8608 KB Output is correct
46 Correct 103 ms 8536 KB Output is correct
47 Correct 64 ms 8536 KB Output is correct
48 Correct 72 ms 8540 KB Output is correct
49 Correct 86 ms 8540 KB Output is correct
50 Correct 94 ms 8604 KB Output is correct
51 Correct 70 ms 8788 KB Output is correct
52 Correct 76 ms 8540 KB Output is correct
53 Correct 91 ms 8620 KB Output is correct
54 Correct 109 ms 8608 KB Output is correct
55 Execution timed out 2086 ms 20180 KB Time limit exceeded
56 Halted 0 ms 0 KB -