# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
925654 |
2024-02-12T06:57:49 Z |
vjudge1 |
Joker (BOI20_joker) |
C++17 |
|
2000 ms |
34504 KB |
#pragma GCC optimize("O3", "unroll-loops") // "Ofast"
#pragma GCC target("avx2", "bmi", "bmi2", "lzcnt", "popcnt")
#include <bits/stdc++.h>
//#define int long long
#define vt vector
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define f first
#define s second
#define dbg(x) cerr << #x << " = " << x << '\n'
#define bit(x, i) ((x) >> (i) & 1)
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
const int N = 1e6 + 5, mod = 1e9 + 7;
const ll inf = 1e18 + 7;
const ld eps = 1e-6;
ll add (ll a, ll b) {
a += b;
if (a < 0) a += mod;
if (a >= mod) a -= mod;
return a;
}
ll mul (ll a, ll b) {
a *= b;
if (a >= mod) a %= mod;
return a;
}
int n, m, Q;
vt<int> g[N];
int used[N];
struct Data {
int x, y, id;
}edge[N];
string get (int l, int r) {
for (int i = 1; i <= n; i++) used[i] = 0, g[i].clear();
for (int i = 1; i <= m; i++) {
int x = edge[i].x, y = edge[i].y, id = edge[i].id;
if (!(id >= l && id <= r)) g[x].pb(y), g[y].pb(x);
}
bool ok = 1;
queue<int> q;
for (int i = 1; i <= n; i++) {
if (!used[i]) {
q.push(i);
used[i] = 1;
while (!q.empty()) {
int v = q.front();
q.pop();
for (auto to: g[v]) {
if (!used[to]) {
used[to] = 3 - used[v];
q.push(to);
}
else if (used[to] == used[v]) ok = 0;
}
}
}
}
return (!ok ? "YES" : "NO");
}
void solve () {
cin >> n >> m >> Q;
for (int i = 1; i <= m; i++) {
int x, y;
cin >> x >> y;
edge[i] = {x, y, i};
}
while (Q--) {
int l, r;
cin >> l >> r;
cout << get(l, r) << '\n';
}
cout << '\n';
}
bool testcases = 0;
signed main() {
#ifdef AMIR
freopen(".in", "r", stdin);
freopen(".out", "w", stdout);
#endif
cin.tie(0) -> sync_with_stdio(0);
int test = 1;
if (testcases) cin >> test;
for (int cs = 1; cs <= test; cs++) {
solve();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
26968 KB |
Output is correct |
2 |
Correct |
7 ms |
26972 KB |
Output is correct |
3 |
Correct |
7 ms |
26972 KB |
Output is correct |
4 |
Correct |
7 ms |
27112 KB |
Output is correct |
5 |
Correct |
9 ms |
27224 KB |
Output is correct |
6 |
Correct |
7 ms |
26972 KB |
Output is correct |
7 |
Correct |
8 ms |
26972 KB |
Output is correct |
8 |
Correct |
8 ms |
26972 KB |
Output is correct |
9 |
Correct |
8 ms |
27084 KB |
Output is correct |
10 |
Correct |
8 ms |
26972 KB |
Output is correct |
11 |
Correct |
8 ms |
26972 KB |
Output is correct |
12 |
Correct |
9 ms |
26972 KB |
Output is correct |
13 |
Correct |
8 ms |
26972 KB |
Output is correct |
14 |
Correct |
8 ms |
26968 KB |
Output is correct |
15 |
Correct |
8 ms |
26972 KB |
Output is correct |
16 |
Correct |
8 ms |
27120 KB |
Output is correct |
17 |
Correct |
8 ms |
26972 KB |
Output is correct |
18 |
Correct |
8 ms |
27072 KB |
Output is correct |
19 |
Correct |
8 ms |
26972 KB |
Output is correct |
20 |
Correct |
8 ms |
26972 KB |
Output is correct |
21 |
Correct |
8 ms |
26972 KB |
Output is correct |
22 |
Correct |
8 ms |
26972 KB |
Output is correct |
23 |
Correct |
7 ms |
26972 KB |
Output is correct |
24 |
Correct |
8 ms |
27080 KB |
Output is correct |
25 |
Correct |
9 ms |
27100 KB |
Output is correct |
26 |
Correct |
8 ms |
27220 KB |
Output is correct |
27 |
Correct |
8 ms |
26972 KB |
Output is correct |
28 |
Correct |
9 ms |
26968 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
26968 KB |
Output is correct |
2 |
Correct |
7 ms |
26972 KB |
Output is correct |
3 |
Correct |
7 ms |
26972 KB |
Output is correct |
4 |
Correct |
7 ms |
27112 KB |
Output is correct |
5 |
Correct |
9 ms |
27224 KB |
Output is correct |
6 |
Correct |
7 ms |
26972 KB |
Output is correct |
7 |
Correct |
8 ms |
26972 KB |
Output is correct |
8 |
Correct |
8 ms |
26972 KB |
Output is correct |
9 |
Correct |
8 ms |
27084 KB |
Output is correct |
10 |
Correct |
8 ms |
26972 KB |
Output is correct |
11 |
Correct |
8 ms |
26972 KB |
Output is correct |
12 |
Correct |
9 ms |
26972 KB |
Output is correct |
13 |
Correct |
8 ms |
26972 KB |
Output is correct |
14 |
Correct |
8 ms |
26968 KB |
Output is correct |
15 |
Correct |
8 ms |
26972 KB |
Output is correct |
16 |
Correct |
8 ms |
27120 KB |
Output is correct |
17 |
Correct |
8 ms |
26972 KB |
Output is correct |
18 |
Correct |
8 ms |
27072 KB |
Output is correct |
19 |
Correct |
8 ms |
26972 KB |
Output is correct |
20 |
Correct |
8 ms |
26972 KB |
Output is correct |
21 |
Correct |
8 ms |
26972 KB |
Output is correct |
22 |
Correct |
8 ms |
26972 KB |
Output is correct |
23 |
Correct |
7 ms |
26972 KB |
Output is correct |
24 |
Correct |
8 ms |
27080 KB |
Output is correct |
25 |
Correct |
9 ms |
27100 KB |
Output is correct |
26 |
Correct |
8 ms |
27220 KB |
Output is correct |
27 |
Correct |
8 ms |
26972 KB |
Output is correct |
28 |
Correct |
9 ms |
26968 KB |
Output is correct |
29 |
Correct |
56 ms |
27160 KB |
Output is correct |
30 |
Correct |
94 ms |
26972 KB |
Output is correct |
31 |
Correct |
83 ms |
26972 KB |
Output is correct |
32 |
Correct |
63 ms |
27184 KB |
Output is correct |
33 |
Correct |
46 ms |
26972 KB |
Output is correct |
34 |
Correct |
94 ms |
27176 KB |
Output is correct |
35 |
Correct |
98 ms |
27172 KB |
Output is correct |
36 |
Correct |
39 ms |
27224 KB |
Output is correct |
37 |
Correct |
71 ms |
26972 KB |
Output is correct |
38 |
Correct |
56 ms |
26972 KB |
Output is correct |
39 |
Correct |
71 ms |
26968 KB |
Output is correct |
40 |
Correct |
59 ms |
26968 KB |
Output is correct |
41 |
Correct |
55 ms |
26972 KB |
Output is correct |
42 |
Correct |
55 ms |
27160 KB |
Output is correct |
43 |
Correct |
40 ms |
26972 KB |
Output is correct |
44 |
Correct |
49 ms |
26972 KB |
Output is correct |
45 |
Correct |
64 ms |
26972 KB |
Output is correct |
46 |
Correct |
72 ms |
27172 KB |
Output is correct |
47 |
Correct |
49 ms |
26972 KB |
Output is correct |
48 |
Correct |
58 ms |
27180 KB |
Output is correct |
49 |
Correct |
69 ms |
26968 KB |
Output is correct |
50 |
Correct |
89 ms |
27172 KB |
Output is correct |
51 |
Correct |
51 ms |
26968 KB |
Output is correct |
52 |
Correct |
63 ms |
26968 KB |
Output is correct |
53 |
Correct |
75 ms |
26968 KB |
Output is correct |
54 |
Correct |
95 ms |
27184 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
26968 KB |
Output is correct |
2 |
Correct |
7 ms |
26972 KB |
Output is correct |
3 |
Execution timed out |
2024 ms |
34492 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
26968 KB |
Output is correct |
2 |
Correct |
7 ms |
26972 KB |
Output is correct |
3 |
Correct |
7 ms |
26972 KB |
Output is correct |
4 |
Correct |
7 ms |
27112 KB |
Output is correct |
5 |
Correct |
9 ms |
27224 KB |
Output is correct |
6 |
Correct |
7 ms |
26972 KB |
Output is correct |
7 |
Correct |
8 ms |
26972 KB |
Output is correct |
8 |
Correct |
8 ms |
26972 KB |
Output is correct |
9 |
Correct |
8 ms |
27084 KB |
Output is correct |
10 |
Correct |
8 ms |
26972 KB |
Output is correct |
11 |
Correct |
8 ms |
26972 KB |
Output is correct |
12 |
Correct |
9 ms |
26972 KB |
Output is correct |
13 |
Correct |
8 ms |
26972 KB |
Output is correct |
14 |
Correct |
8 ms |
26968 KB |
Output is correct |
15 |
Correct |
8 ms |
26972 KB |
Output is correct |
16 |
Correct |
8 ms |
27120 KB |
Output is correct |
17 |
Correct |
8 ms |
26972 KB |
Output is correct |
18 |
Correct |
8 ms |
27072 KB |
Output is correct |
19 |
Correct |
8 ms |
26972 KB |
Output is correct |
20 |
Correct |
8 ms |
26972 KB |
Output is correct |
21 |
Correct |
8 ms |
26972 KB |
Output is correct |
22 |
Correct |
8 ms |
26972 KB |
Output is correct |
23 |
Correct |
7 ms |
26972 KB |
Output is correct |
24 |
Correct |
8 ms |
27080 KB |
Output is correct |
25 |
Correct |
9 ms |
27100 KB |
Output is correct |
26 |
Correct |
8 ms |
27220 KB |
Output is correct |
27 |
Correct |
8 ms |
26972 KB |
Output is correct |
28 |
Correct |
9 ms |
26968 KB |
Output is correct |
29 |
Execution timed out |
2024 ms |
34492 KB |
Time limit exceeded |
30 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
26968 KB |
Output is correct |
2 |
Correct |
7 ms |
26972 KB |
Output is correct |
3 |
Correct |
7 ms |
26972 KB |
Output is correct |
4 |
Correct |
7 ms |
27112 KB |
Output is correct |
5 |
Correct |
9 ms |
27224 KB |
Output is correct |
6 |
Correct |
7 ms |
26972 KB |
Output is correct |
7 |
Correct |
8 ms |
26972 KB |
Output is correct |
8 |
Correct |
8 ms |
26972 KB |
Output is correct |
9 |
Correct |
8 ms |
27084 KB |
Output is correct |
10 |
Correct |
8 ms |
26972 KB |
Output is correct |
11 |
Correct |
8 ms |
26972 KB |
Output is correct |
12 |
Correct |
9 ms |
26972 KB |
Output is correct |
13 |
Correct |
8 ms |
26972 KB |
Output is correct |
14 |
Correct |
8 ms |
26968 KB |
Output is correct |
15 |
Correct |
8 ms |
26972 KB |
Output is correct |
16 |
Correct |
8 ms |
27120 KB |
Output is correct |
17 |
Correct |
8 ms |
26972 KB |
Output is correct |
18 |
Correct |
8 ms |
27072 KB |
Output is correct |
19 |
Correct |
8 ms |
26972 KB |
Output is correct |
20 |
Correct |
8 ms |
26972 KB |
Output is correct |
21 |
Correct |
8 ms |
26972 KB |
Output is correct |
22 |
Correct |
8 ms |
26972 KB |
Output is correct |
23 |
Correct |
7 ms |
26972 KB |
Output is correct |
24 |
Correct |
8 ms |
27080 KB |
Output is correct |
25 |
Correct |
9 ms |
27100 KB |
Output is correct |
26 |
Correct |
8 ms |
27220 KB |
Output is correct |
27 |
Correct |
8 ms |
26972 KB |
Output is correct |
28 |
Correct |
9 ms |
26968 KB |
Output is correct |
29 |
Correct |
56 ms |
27160 KB |
Output is correct |
30 |
Correct |
94 ms |
26972 KB |
Output is correct |
31 |
Correct |
83 ms |
26972 KB |
Output is correct |
32 |
Correct |
63 ms |
27184 KB |
Output is correct |
33 |
Correct |
46 ms |
26972 KB |
Output is correct |
34 |
Correct |
94 ms |
27176 KB |
Output is correct |
35 |
Correct |
98 ms |
27172 KB |
Output is correct |
36 |
Correct |
39 ms |
27224 KB |
Output is correct |
37 |
Correct |
71 ms |
26972 KB |
Output is correct |
38 |
Correct |
56 ms |
26972 KB |
Output is correct |
39 |
Correct |
71 ms |
26968 KB |
Output is correct |
40 |
Correct |
59 ms |
26968 KB |
Output is correct |
41 |
Correct |
55 ms |
26972 KB |
Output is correct |
42 |
Correct |
55 ms |
27160 KB |
Output is correct |
43 |
Correct |
40 ms |
26972 KB |
Output is correct |
44 |
Correct |
49 ms |
26972 KB |
Output is correct |
45 |
Correct |
64 ms |
26972 KB |
Output is correct |
46 |
Correct |
72 ms |
27172 KB |
Output is correct |
47 |
Correct |
49 ms |
26972 KB |
Output is correct |
48 |
Correct |
58 ms |
27180 KB |
Output is correct |
49 |
Correct |
69 ms |
26968 KB |
Output is correct |
50 |
Correct |
89 ms |
27172 KB |
Output is correct |
51 |
Correct |
51 ms |
26968 KB |
Output is correct |
52 |
Correct |
63 ms |
26968 KB |
Output is correct |
53 |
Correct |
75 ms |
26968 KB |
Output is correct |
54 |
Correct |
95 ms |
27184 KB |
Output is correct |
55 |
Execution timed out |
2055 ms |
34504 KB |
Time limit exceeded |
56 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
26968 KB |
Output is correct |
2 |
Correct |
7 ms |
26972 KB |
Output is correct |
3 |
Correct |
7 ms |
26972 KB |
Output is correct |
4 |
Correct |
7 ms |
27112 KB |
Output is correct |
5 |
Correct |
9 ms |
27224 KB |
Output is correct |
6 |
Correct |
7 ms |
26972 KB |
Output is correct |
7 |
Correct |
8 ms |
26972 KB |
Output is correct |
8 |
Correct |
8 ms |
26972 KB |
Output is correct |
9 |
Correct |
8 ms |
27084 KB |
Output is correct |
10 |
Correct |
8 ms |
26972 KB |
Output is correct |
11 |
Correct |
8 ms |
26972 KB |
Output is correct |
12 |
Correct |
9 ms |
26972 KB |
Output is correct |
13 |
Correct |
8 ms |
26972 KB |
Output is correct |
14 |
Correct |
8 ms |
26968 KB |
Output is correct |
15 |
Correct |
8 ms |
26972 KB |
Output is correct |
16 |
Correct |
8 ms |
27120 KB |
Output is correct |
17 |
Correct |
8 ms |
26972 KB |
Output is correct |
18 |
Correct |
8 ms |
27072 KB |
Output is correct |
19 |
Correct |
8 ms |
26972 KB |
Output is correct |
20 |
Correct |
8 ms |
26972 KB |
Output is correct |
21 |
Correct |
8 ms |
26972 KB |
Output is correct |
22 |
Correct |
8 ms |
26972 KB |
Output is correct |
23 |
Correct |
7 ms |
26972 KB |
Output is correct |
24 |
Correct |
8 ms |
27080 KB |
Output is correct |
25 |
Correct |
9 ms |
27100 KB |
Output is correct |
26 |
Correct |
8 ms |
27220 KB |
Output is correct |
27 |
Correct |
8 ms |
26972 KB |
Output is correct |
28 |
Correct |
9 ms |
26968 KB |
Output is correct |
29 |
Correct |
56 ms |
27160 KB |
Output is correct |
30 |
Correct |
94 ms |
26972 KB |
Output is correct |
31 |
Correct |
83 ms |
26972 KB |
Output is correct |
32 |
Correct |
63 ms |
27184 KB |
Output is correct |
33 |
Correct |
46 ms |
26972 KB |
Output is correct |
34 |
Correct |
94 ms |
27176 KB |
Output is correct |
35 |
Correct |
98 ms |
27172 KB |
Output is correct |
36 |
Correct |
39 ms |
27224 KB |
Output is correct |
37 |
Correct |
71 ms |
26972 KB |
Output is correct |
38 |
Correct |
56 ms |
26972 KB |
Output is correct |
39 |
Correct |
71 ms |
26968 KB |
Output is correct |
40 |
Correct |
59 ms |
26968 KB |
Output is correct |
41 |
Correct |
55 ms |
26972 KB |
Output is correct |
42 |
Correct |
55 ms |
27160 KB |
Output is correct |
43 |
Correct |
40 ms |
26972 KB |
Output is correct |
44 |
Correct |
49 ms |
26972 KB |
Output is correct |
45 |
Correct |
64 ms |
26972 KB |
Output is correct |
46 |
Correct |
72 ms |
27172 KB |
Output is correct |
47 |
Correct |
49 ms |
26972 KB |
Output is correct |
48 |
Correct |
58 ms |
27180 KB |
Output is correct |
49 |
Correct |
69 ms |
26968 KB |
Output is correct |
50 |
Correct |
89 ms |
27172 KB |
Output is correct |
51 |
Correct |
51 ms |
26968 KB |
Output is correct |
52 |
Correct |
63 ms |
26968 KB |
Output is correct |
53 |
Correct |
75 ms |
26968 KB |
Output is correct |
54 |
Correct |
95 ms |
27184 KB |
Output is correct |
55 |
Execution timed out |
2024 ms |
34492 KB |
Time limit exceeded |
56 |
Halted |
0 ms |
0 KB |
- |