# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
931405 |
2024-02-21T18:12:00 Z |
qwusha |
Joker (BOI20_joker) |
C++17 |
|
2000 ms |
16032 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
typedef long double ld;
const ll inf = 1e9;
const ld eps = 1e-8;
const ll logs = 32;
#include <cmath>
bool ch = 0;
vector<vector<pair<int, int>>> g;
vector<bool> ok;
vector<int> col;
void dfs(int v, int c = 0) {
col[v] = c;
for (auto [u, ind] : g[v]) {
if (!ok[ind]) {
continue;
}
if (col[u] == -1)
dfs(u, 1 - c);
else if (col[u] == col[v])
ch = 1;
}
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, m, q;
cin >> n >> m >> q;
g.resize(n);
ok.resize(m, 1);
col.resize(n);
for (int i = 0; i < m; i++) {
int v, u;
cin >> v >> u;
g[v - 1].push_back({u - 1, i});
g[u - 1].push_back({v - 1, i});
}
for (int qw = 0; qw < q; qw++) {
int l, r;
cin >> l >> r;
for (int i = 0; i < m; i++) {
if (l - 1 <= i && i < r)
ok[i] = 0;
else
ok[i] = 1;
}
for (int i = 0; i < n; i++) {
col[i] = -1;
}
bool check = 0;
for (int i = 0; i < n; i++) {
if (col[i] == -1) {
ch = 0;
dfs(i);
if (ch)
check = 1;
}
}
if (check) {
cout << "YES" << '\n';
} else {
cout << "NO" << '\n';
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
456 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
2 ms |
460 KB |
Output is correct |
12 |
Correct |
2 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
476 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
464 KB |
Output is correct |
19 |
Correct |
1 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
344 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
456 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
2 ms |
460 KB |
Output is correct |
12 |
Correct |
2 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
476 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
464 KB |
Output is correct |
19 |
Correct |
1 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
344 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
348 KB |
Output is correct |
29 |
Correct |
49 ms |
572 KB |
Output is correct |
30 |
Correct |
109 ms |
600 KB |
Output is correct |
31 |
Correct |
105 ms |
600 KB |
Output is correct |
32 |
Correct |
88 ms |
604 KB |
Output is correct |
33 |
Correct |
72 ms |
604 KB |
Output is correct |
34 |
Correct |
113 ms |
632 KB |
Output is correct |
35 |
Correct |
120 ms |
604 KB |
Output is correct |
36 |
Correct |
36 ms |
604 KB |
Output is correct |
37 |
Correct |
67 ms |
604 KB |
Output is correct |
38 |
Correct |
53 ms |
632 KB |
Output is correct |
39 |
Correct |
78 ms |
620 KB |
Output is correct |
40 |
Correct |
75 ms |
604 KB |
Output is correct |
41 |
Correct |
81 ms |
600 KB |
Output is correct |
42 |
Correct |
76 ms |
600 KB |
Output is correct |
43 |
Correct |
61 ms |
344 KB |
Output is correct |
44 |
Correct |
76 ms |
624 KB |
Output is correct |
45 |
Correct |
89 ms |
892 KB |
Output is correct |
46 |
Correct |
98 ms |
888 KB |
Output is correct |
47 |
Correct |
74 ms |
348 KB |
Output is correct |
48 |
Correct |
82 ms |
600 KB |
Output is correct |
49 |
Correct |
94 ms |
600 KB |
Output is correct |
50 |
Correct |
112 ms |
848 KB |
Output is correct |
51 |
Correct |
76 ms |
600 KB |
Output is correct |
52 |
Correct |
87 ms |
604 KB |
Output is correct |
53 |
Correct |
99 ms |
616 KB |
Output is correct |
54 |
Correct |
116 ms |
628 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Execution timed out |
2078 ms |
14572 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
456 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
2 ms |
460 KB |
Output is correct |
12 |
Correct |
2 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
476 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
464 KB |
Output is correct |
19 |
Correct |
1 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
344 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
348 KB |
Output is correct |
29 |
Execution timed out |
2078 ms |
14572 KB |
Time limit exceeded |
30 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
456 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
2 ms |
460 KB |
Output is correct |
12 |
Correct |
2 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
476 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
464 KB |
Output is correct |
19 |
Correct |
1 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
344 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
348 KB |
Output is correct |
29 |
Correct |
49 ms |
572 KB |
Output is correct |
30 |
Correct |
109 ms |
600 KB |
Output is correct |
31 |
Correct |
105 ms |
600 KB |
Output is correct |
32 |
Correct |
88 ms |
604 KB |
Output is correct |
33 |
Correct |
72 ms |
604 KB |
Output is correct |
34 |
Correct |
113 ms |
632 KB |
Output is correct |
35 |
Correct |
120 ms |
604 KB |
Output is correct |
36 |
Correct |
36 ms |
604 KB |
Output is correct |
37 |
Correct |
67 ms |
604 KB |
Output is correct |
38 |
Correct |
53 ms |
632 KB |
Output is correct |
39 |
Correct |
78 ms |
620 KB |
Output is correct |
40 |
Correct |
75 ms |
604 KB |
Output is correct |
41 |
Correct |
81 ms |
600 KB |
Output is correct |
42 |
Correct |
76 ms |
600 KB |
Output is correct |
43 |
Correct |
61 ms |
344 KB |
Output is correct |
44 |
Correct |
76 ms |
624 KB |
Output is correct |
45 |
Correct |
89 ms |
892 KB |
Output is correct |
46 |
Correct |
98 ms |
888 KB |
Output is correct |
47 |
Correct |
74 ms |
348 KB |
Output is correct |
48 |
Correct |
82 ms |
600 KB |
Output is correct |
49 |
Correct |
94 ms |
600 KB |
Output is correct |
50 |
Correct |
112 ms |
848 KB |
Output is correct |
51 |
Correct |
76 ms |
600 KB |
Output is correct |
52 |
Correct |
87 ms |
604 KB |
Output is correct |
53 |
Correct |
99 ms |
616 KB |
Output is correct |
54 |
Correct |
116 ms |
628 KB |
Output is correct |
55 |
Execution timed out |
2093 ms |
16032 KB |
Time limit exceeded |
56 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
456 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
2 ms |
460 KB |
Output is correct |
12 |
Correct |
2 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
476 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
464 KB |
Output is correct |
19 |
Correct |
1 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
344 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
348 KB |
Output is correct |
29 |
Correct |
49 ms |
572 KB |
Output is correct |
30 |
Correct |
109 ms |
600 KB |
Output is correct |
31 |
Correct |
105 ms |
600 KB |
Output is correct |
32 |
Correct |
88 ms |
604 KB |
Output is correct |
33 |
Correct |
72 ms |
604 KB |
Output is correct |
34 |
Correct |
113 ms |
632 KB |
Output is correct |
35 |
Correct |
120 ms |
604 KB |
Output is correct |
36 |
Correct |
36 ms |
604 KB |
Output is correct |
37 |
Correct |
67 ms |
604 KB |
Output is correct |
38 |
Correct |
53 ms |
632 KB |
Output is correct |
39 |
Correct |
78 ms |
620 KB |
Output is correct |
40 |
Correct |
75 ms |
604 KB |
Output is correct |
41 |
Correct |
81 ms |
600 KB |
Output is correct |
42 |
Correct |
76 ms |
600 KB |
Output is correct |
43 |
Correct |
61 ms |
344 KB |
Output is correct |
44 |
Correct |
76 ms |
624 KB |
Output is correct |
45 |
Correct |
89 ms |
892 KB |
Output is correct |
46 |
Correct |
98 ms |
888 KB |
Output is correct |
47 |
Correct |
74 ms |
348 KB |
Output is correct |
48 |
Correct |
82 ms |
600 KB |
Output is correct |
49 |
Correct |
94 ms |
600 KB |
Output is correct |
50 |
Correct |
112 ms |
848 KB |
Output is correct |
51 |
Correct |
76 ms |
600 KB |
Output is correct |
52 |
Correct |
87 ms |
604 KB |
Output is correct |
53 |
Correct |
99 ms |
616 KB |
Output is correct |
54 |
Correct |
116 ms |
628 KB |
Output is correct |
55 |
Execution timed out |
2078 ms |
14572 KB |
Time limit exceeded |
56 |
Halted |
0 ms |
0 KB |
- |