Submission #467560

# Submission time Handle Problem Language Result Execution time Memory
467560 2021-08-23T16:46:34 Z MVP_Harry Joker (BOI20_joker) C++17
14 / 100
2000 ms 19652 KB
#include <bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
#define rep(i, m, n) for (int i = m; i <= n; i++)
#define per(i, m, n) for (int i = m; i >= n; i--)
#define sz(v) (int) v.size()
#define all(v) v.begin(), v.end()
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second

const int maxn = 2e5 + 5;

int N, M, Q, ok = 0;
int vis[maxn];
vector<pair<int, int> > G[maxn];

void dfs(int u, int par, int col, int l, int r) {
	vis[u] = col;
	for (auto node : G[u]) {
		if (node.fi == par || (l <= node.se && node.se <= r)) continue;
		if (vis[node.fi] == vis[u]) ok = 1;
		if (!vis[node.fi])
			dfs(node.fi, u, 3 - col, l, r);
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> N >> M >> Q;
	rep(i, 1, M) {
		int u, v;
		cin >> u >> v;
		G[u].push_back(mp(v, i));
		G[v].push_back(mp(u, i));
	}
	while (Q--) {
		int l, r;
		cin >> l >> r;
		ok = 0;
		rep(i, 1, N) vis[i] = 0;
		rep(i, 1, N) if (!vis[i])
			dfs(i, 0, 1, l, r);
		cout << (ok ? "YES\n" : "NO\n");
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Correct 3 ms 4940 KB Output is correct
3 Correct 4 ms 5020 KB Output is correct
4 Correct 4 ms 4940 KB Output is correct
5 Correct 4 ms 5016 KB Output is correct
6 Correct 3 ms 5016 KB Output is correct
7 Correct 4 ms 4940 KB Output is correct
8 Correct 4 ms 4940 KB Output is correct
9 Correct 4 ms 4980 KB Output is correct
10 Correct 4 ms 4940 KB Output is correct
11 Correct 4 ms 4940 KB Output is correct
12 Correct 4 ms 4940 KB Output is correct
13 Correct 4 ms 4940 KB Output is correct
14 Correct 4 ms 4940 KB Output is correct
15 Correct 4 ms 4940 KB Output is correct
16 Correct 4 ms 5016 KB Output is correct
17 Correct 4 ms 4940 KB Output is correct
18 Correct 4 ms 5016 KB Output is correct
19 Correct 4 ms 4940 KB Output is correct
20 Correct 4 ms 5024 KB Output is correct
21 Correct 6 ms 4940 KB Output is correct
22 Correct 5 ms 5020 KB Output is correct
23 Correct 4 ms 4940 KB Output is correct
24 Correct 5 ms 4940 KB Output is correct
25 Correct 4 ms 4940 KB Output is correct
26 Correct 4 ms 4940 KB Output is correct
27 Correct 4 ms 4940 KB Output is correct
28 Correct 5 ms 4940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Correct 3 ms 4940 KB Output is correct
3 Correct 4 ms 5020 KB Output is correct
4 Correct 4 ms 4940 KB Output is correct
5 Correct 4 ms 5016 KB Output is correct
6 Correct 3 ms 5016 KB Output is correct
7 Correct 4 ms 4940 KB Output is correct
8 Correct 4 ms 4940 KB Output is correct
9 Correct 4 ms 4980 KB Output is correct
10 Correct 4 ms 4940 KB Output is correct
11 Correct 4 ms 4940 KB Output is correct
12 Correct 4 ms 4940 KB Output is correct
13 Correct 4 ms 4940 KB Output is correct
14 Correct 4 ms 4940 KB Output is correct
15 Correct 4 ms 4940 KB Output is correct
16 Correct 4 ms 5016 KB Output is correct
17 Correct 4 ms 4940 KB Output is correct
18 Correct 4 ms 5016 KB Output is correct
19 Correct 4 ms 4940 KB Output is correct
20 Correct 4 ms 5024 KB Output is correct
21 Correct 6 ms 4940 KB Output is correct
22 Correct 5 ms 5020 KB Output is correct
23 Correct 4 ms 4940 KB Output is correct
24 Correct 5 ms 4940 KB Output is correct
25 Correct 4 ms 4940 KB Output is correct
26 Correct 4 ms 4940 KB Output is correct
27 Correct 4 ms 4940 KB Output is correct
28 Correct 5 ms 4940 KB Output is correct
29 Correct 75 ms 5068 KB Output is correct
30 Correct 126 ms 5140 KB Output is correct
31 Correct 122 ms 5168 KB Output is correct
32 Correct 100 ms 5068 KB Output is correct
33 Correct 84 ms 5152 KB Output is correct
34 Correct 147 ms 5072 KB Output is correct
35 Correct 139 ms 5068 KB Output is correct
36 Correct 37 ms 5200 KB Output is correct
37 Correct 81 ms 5176 KB Output is correct
38 Correct 82 ms 5156 KB Output is correct
39 Correct 92 ms 5068 KB Output is correct
40 Correct 92 ms 5164 KB Output is correct
41 Correct 91 ms 5272 KB Output is correct
42 Correct 93 ms 5188 KB Output is correct
43 Correct 118 ms 5068 KB Output is correct
44 Correct 120 ms 5156 KB Output is correct
45 Correct 132 ms 5068 KB Output is correct
46 Correct 136 ms 5100 KB Output is correct
47 Correct 90 ms 5028 KB Output is correct
48 Correct 98 ms 5068 KB Output is correct
49 Correct 110 ms 5156 KB Output is correct
50 Correct 124 ms 5032 KB Output is correct
51 Correct 89 ms 5068 KB Output is correct
52 Correct 103 ms 5160 KB Output is correct
53 Correct 115 ms 5068 KB Output is correct
54 Correct 137 ms 5068 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Correct 3 ms 4940 KB Output is correct
3 Execution timed out 2063 ms 18028 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Correct 3 ms 4940 KB Output is correct
3 Correct 4 ms 5020 KB Output is correct
4 Correct 4 ms 4940 KB Output is correct
5 Correct 4 ms 5016 KB Output is correct
6 Correct 3 ms 5016 KB Output is correct
7 Correct 4 ms 4940 KB Output is correct
8 Correct 4 ms 4940 KB Output is correct
9 Correct 4 ms 4980 KB Output is correct
10 Correct 4 ms 4940 KB Output is correct
11 Correct 4 ms 4940 KB Output is correct
12 Correct 4 ms 4940 KB Output is correct
13 Correct 4 ms 4940 KB Output is correct
14 Correct 4 ms 4940 KB Output is correct
15 Correct 4 ms 4940 KB Output is correct
16 Correct 4 ms 5016 KB Output is correct
17 Correct 4 ms 4940 KB Output is correct
18 Correct 4 ms 5016 KB Output is correct
19 Correct 4 ms 4940 KB Output is correct
20 Correct 4 ms 5024 KB Output is correct
21 Correct 6 ms 4940 KB Output is correct
22 Correct 5 ms 5020 KB Output is correct
23 Correct 4 ms 4940 KB Output is correct
24 Correct 5 ms 4940 KB Output is correct
25 Correct 4 ms 4940 KB Output is correct
26 Correct 4 ms 4940 KB Output is correct
27 Correct 4 ms 4940 KB Output is correct
28 Correct 5 ms 4940 KB Output is correct
29 Execution timed out 2063 ms 18028 KB Time limit exceeded
30 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Correct 3 ms 4940 KB Output is correct
3 Correct 4 ms 5020 KB Output is correct
4 Correct 4 ms 4940 KB Output is correct
5 Correct 4 ms 5016 KB Output is correct
6 Correct 3 ms 5016 KB Output is correct
7 Correct 4 ms 4940 KB Output is correct
8 Correct 4 ms 4940 KB Output is correct
9 Correct 4 ms 4980 KB Output is correct
10 Correct 4 ms 4940 KB Output is correct
11 Correct 4 ms 4940 KB Output is correct
12 Correct 4 ms 4940 KB Output is correct
13 Correct 4 ms 4940 KB Output is correct
14 Correct 4 ms 4940 KB Output is correct
15 Correct 4 ms 4940 KB Output is correct
16 Correct 4 ms 5016 KB Output is correct
17 Correct 4 ms 4940 KB Output is correct
18 Correct 4 ms 5016 KB Output is correct
19 Correct 4 ms 4940 KB Output is correct
20 Correct 4 ms 5024 KB Output is correct
21 Correct 6 ms 4940 KB Output is correct
22 Correct 5 ms 5020 KB Output is correct
23 Correct 4 ms 4940 KB Output is correct
24 Correct 5 ms 4940 KB Output is correct
25 Correct 4 ms 4940 KB Output is correct
26 Correct 4 ms 4940 KB Output is correct
27 Correct 4 ms 4940 KB Output is correct
28 Correct 5 ms 4940 KB Output is correct
29 Correct 75 ms 5068 KB Output is correct
30 Correct 126 ms 5140 KB Output is correct
31 Correct 122 ms 5168 KB Output is correct
32 Correct 100 ms 5068 KB Output is correct
33 Correct 84 ms 5152 KB Output is correct
34 Correct 147 ms 5072 KB Output is correct
35 Correct 139 ms 5068 KB Output is correct
36 Correct 37 ms 5200 KB Output is correct
37 Correct 81 ms 5176 KB Output is correct
38 Correct 82 ms 5156 KB Output is correct
39 Correct 92 ms 5068 KB Output is correct
40 Correct 92 ms 5164 KB Output is correct
41 Correct 91 ms 5272 KB Output is correct
42 Correct 93 ms 5188 KB Output is correct
43 Correct 118 ms 5068 KB Output is correct
44 Correct 120 ms 5156 KB Output is correct
45 Correct 132 ms 5068 KB Output is correct
46 Correct 136 ms 5100 KB Output is correct
47 Correct 90 ms 5028 KB Output is correct
48 Correct 98 ms 5068 KB Output is correct
49 Correct 110 ms 5156 KB Output is correct
50 Correct 124 ms 5032 KB Output is correct
51 Correct 89 ms 5068 KB Output is correct
52 Correct 103 ms 5160 KB Output is correct
53 Correct 115 ms 5068 KB Output is correct
54 Correct 137 ms 5068 KB Output is correct
55 Execution timed out 2073 ms 19652 KB Time limit exceeded
56 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Correct 3 ms 4940 KB Output is correct
3 Correct 4 ms 5020 KB Output is correct
4 Correct 4 ms 4940 KB Output is correct
5 Correct 4 ms 5016 KB Output is correct
6 Correct 3 ms 5016 KB Output is correct
7 Correct 4 ms 4940 KB Output is correct
8 Correct 4 ms 4940 KB Output is correct
9 Correct 4 ms 4980 KB Output is correct
10 Correct 4 ms 4940 KB Output is correct
11 Correct 4 ms 4940 KB Output is correct
12 Correct 4 ms 4940 KB Output is correct
13 Correct 4 ms 4940 KB Output is correct
14 Correct 4 ms 4940 KB Output is correct
15 Correct 4 ms 4940 KB Output is correct
16 Correct 4 ms 5016 KB Output is correct
17 Correct 4 ms 4940 KB Output is correct
18 Correct 4 ms 5016 KB Output is correct
19 Correct 4 ms 4940 KB Output is correct
20 Correct 4 ms 5024 KB Output is correct
21 Correct 6 ms 4940 KB Output is correct
22 Correct 5 ms 5020 KB Output is correct
23 Correct 4 ms 4940 KB Output is correct
24 Correct 5 ms 4940 KB Output is correct
25 Correct 4 ms 4940 KB Output is correct
26 Correct 4 ms 4940 KB Output is correct
27 Correct 4 ms 4940 KB Output is correct
28 Correct 5 ms 4940 KB Output is correct
29 Correct 75 ms 5068 KB Output is correct
30 Correct 126 ms 5140 KB Output is correct
31 Correct 122 ms 5168 KB Output is correct
32 Correct 100 ms 5068 KB Output is correct
33 Correct 84 ms 5152 KB Output is correct
34 Correct 147 ms 5072 KB Output is correct
35 Correct 139 ms 5068 KB Output is correct
36 Correct 37 ms 5200 KB Output is correct
37 Correct 81 ms 5176 KB Output is correct
38 Correct 82 ms 5156 KB Output is correct
39 Correct 92 ms 5068 KB Output is correct
40 Correct 92 ms 5164 KB Output is correct
41 Correct 91 ms 5272 KB Output is correct
42 Correct 93 ms 5188 KB Output is correct
43 Correct 118 ms 5068 KB Output is correct
44 Correct 120 ms 5156 KB Output is correct
45 Correct 132 ms 5068 KB Output is correct
46 Correct 136 ms 5100 KB Output is correct
47 Correct 90 ms 5028 KB Output is correct
48 Correct 98 ms 5068 KB Output is correct
49 Correct 110 ms 5156 KB Output is correct
50 Correct 124 ms 5032 KB Output is correct
51 Correct 89 ms 5068 KB Output is correct
52 Correct 103 ms 5160 KB Output is correct
53 Correct 115 ms 5068 KB Output is correct
54 Correct 137 ms 5068 KB Output is correct
55 Execution timed out 2063 ms 18028 KB Time limit exceeded
56 Halted 0 ms 0 KB -