# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
289874 |
2020-09-03T07:46:32 Z |
someone_aa |
Joker (BOI20_joker) |
C++17 |
|
2000 ms |
13304 KB |
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
using namespace std;
const int maxn = 200100;
ll n, m, q;
vector<pii>g[maxn];
bool visited[maxn];
int color[maxn];
bool check(int l, int r) {
memset(visited, false,sizeof(visited));
memset(color, 0, sizeof(color));
bool cycle = false;
for(int i=1;i<=n;i++) {
if(!visited[i]) {
visited[i] = true;
color[i] = 1;
queue<int>q;
q.push(i);
while(!q.empty()) {
int curr = q.front();
q.pop();
for(auto i:g[curr]) {
if(l <= i.second && i.second <= r) continue;
if(!visited[i.first]) {
visited[i.first] = true;
color[i.first] = 3 - color[curr];
q.push(i.first);
}
else {
if(color[i.first] == color[curr]) cycle = true;
}
}
}
}
}
return cycle;
}
int main() {
cin>>n>>m>>q;
int u, v;
for(int i=1;i<=m;i++) {
cin>>u>>v;
g[u].pb(mp(v, i));
g[v].pb(mp(u, i));
}
int l, r;
while(q--) {
cin>>l>>r;
if(check(l, r)) cout<<"YES\n";
else cout<<"NO\n";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
6016 KB |
Output is correct |
2 |
Correct |
5 ms |
6048 KB |
Output is correct |
3 |
Correct |
4 ms |
6016 KB |
Output is correct |
4 |
Correct |
4 ms |
6016 KB |
Output is correct |
5 |
Correct |
5 ms |
6016 KB |
Output is correct |
6 |
Correct |
5 ms |
6016 KB |
Output is correct |
7 |
Correct |
17 ms |
6016 KB |
Output is correct |
8 |
Correct |
15 ms |
6016 KB |
Output is correct |
9 |
Correct |
15 ms |
6016 KB |
Output is correct |
10 |
Correct |
14 ms |
6016 KB |
Output is correct |
11 |
Correct |
15 ms |
5964 KB |
Output is correct |
12 |
Correct |
15 ms |
6016 KB |
Output is correct |
13 |
Correct |
14 ms |
6016 KB |
Output is correct |
14 |
Correct |
15 ms |
6016 KB |
Output is correct |
15 |
Correct |
15 ms |
6016 KB |
Output is correct |
16 |
Correct |
15 ms |
6016 KB |
Output is correct |
17 |
Correct |
14 ms |
6016 KB |
Output is correct |
18 |
Correct |
17 ms |
6016 KB |
Output is correct |
19 |
Correct |
17 ms |
6016 KB |
Output is correct |
20 |
Correct |
16 ms |
6016 KB |
Output is correct |
21 |
Correct |
16 ms |
6016 KB |
Output is correct |
22 |
Correct |
14 ms |
6016 KB |
Output is correct |
23 |
Correct |
14 ms |
6016 KB |
Output is correct |
24 |
Correct |
13 ms |
6016 KB |
Output is correct |
25 |
Correct |
14 ms |
6016 KB |
Output is correct |
26 |
Correct |
17 ms |
6016 KB |
Output is correct |
27 |
Correct |
16 ms |
6016 KB |
Output is correct |
28 |
Correct |
14 ms |
6016 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
6016 KB |
Output is correct |
2 |
Correct |
5 ms |
6048 KB |
Output is correct |
3 |
Correct |
4 ms |
6016 KB |
Output is correct |
4 |
Correct |
4 ms |
6016 KB |
Output is correct |
5 |
Correct |
5 ms |
6016 KB |
Output is correct |
6 |
Correct |
5 ms |
6016 KB |
Output is correct |
7 |
Correct |
17 ms |
6016 KB |
Output is correct |
8 |
Correct |
15 ms |
6016 KB |
Output is correct |
9 |
Correct |
15 ms |
6016 KB |
Output is correct |
10 |
Correct |
14 ms |
6016 KB |
Output is correct |
11 |
Correct |
15 ms |
5964 KB |
Output is correct |
12 |
Correct |
15 ms |
6016 KB |
Output is correct |
13 |
Correct |
14 ms |
6016 KB |
Output is correct |
14 |
Correct |
15 ms |
6016 KB |
Output is correct |
15 |
Correct |
15 ms |
6016 KB |
Output is correct |
16 |
Correct |
15 ms |
6016 KB |
Output is correct |
17 |
Correct |
14 ms |
6016 KB |
Output is correct |
18 |
Correct |
17 ms |
6016 KB |
Output is correct |
19 |
Correct |
17 ms |
6016 KB |
Output is correct |
20 |
Correct |
16 ms |
6016 KB |
Output is correct |
21 |
Correct |
16 ms |
6016 KB |
Output is correct |
22 |
Correct |
14 ms |
6016 KB |
Output is correct |
23 |
Correct |
14 ms |
6016 KB |
Output is correct |
24 |
Correct |
13 ms |
6016 KB |
Output is correct |
25 |
Correct |
14 ms |
6016 KB |
Output is correct |
26 |
Correct |
17 ms |
6016 KB |
Output is correct |
27 |
Correct |
16 ms |
6016 KB |
Output is correct |
28 |
Correct |
14 ms |
6016 KB |
Output is correct |
29 |
Correct |
390 ms |
6100 KB |
Output is correct |
30 |
Correct |
593 ms |
6148 KB |
Output is correct |
31 |
Correct |
422 ms |
6156 KB |
Output is correct |
32 |
Correct |
273 ms |
6100 KB |
Output is correct |
33 |
Correct |
222 ms |
6144 KB |
Output is correct |
34 |
Correct |
560 ms |
6144 KB |
Output is correct |
35 |
Correct |
535 ms |
6144 KB |
Output is correct |
36 |
Correct |
208 ms |
6016 KB |
Output is correct |
37 |
Correct |
351 ms |
6144 KB |
Output is correct |
38 |
Correct |
301 ms |
6148 KB |
Output is correct |
39 |
Correct |
489 ms |
6152 KB |
Output is correct |
40 |
Correct |
265 ms |
6264 KB |
Output is correct |
41 |
Correct |
275 ms |
6136 KB |
Output is correct |
42 |
Correct |
282 ms |
6160 KB |
Output is correct |
43 |
Correct |
179 ms |
6144 KB |
Output is correct |
44 |
Correct |
220 ms |
6152 KB |
Output is correct |
45 |
Correct |
332 ms |
6152 KB |
Output is correct |
46 |
Correct |
431 ms |
6144 KB |
Output is correct |
47 |
Correct |
219 ms |
6264 KB |
Output is correct |
48 |
Correct |
244 ms |
6144 KB |
Output is correct |
49 |
Correct |
393 ms |
6148 KB |
Output is correct |
50 |
Correct |
538 ms |
6152 KB |
Output is correct |
51 |
Correct |
208 ms |
6144 KB |
Output is correct |
52 |
Correct |
268 ms |
6144 KB |
Output is correct |
53 |
Correct |
421 ms |
6264 KB |
Output is correct |
54 |
Correct |
656 ms |
6136 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
6016 KB |
Output is correct |
2 |
Correct |
5 ms |
6048 KB |
Output is correct |
3 |
Execution timed out |
2059 ms |
13304 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
6016 KB |
Output is correct |
2 |
Correct |
5 ms |
6048 KB |
Output is correct |
3 |
Correct |
4 ms |
6016 KB |
Output is correct |
4 |
Correct |
4 ms |
6016 KB |
Output is correct |
5 |
Correct |
5 ms |
6016 KB |
Output is correct |
6 |
Correct |
5 ms |
6016 KB |
Output is correct |
7 |
Correct |
17 ms |
6016 KB |
Output is correct |
8 |
Correct |
15 ms |
6016 KB |
Output is correct |
9 |
Correct |
15 ms |
6016 KB |
Output is correct |
10 |
Correct |
14 ms |
6016 KB |
Output is correct |
11 |
Correct |
15 ms |
5964 KB |
Output is correct |
12 |
Correct |
15 ms |
6016 KB |
Output is correct |
13 |
Correct |
14 ms |
6016 KB |
Output is correct |
14 |
Correct |
15 ms |
6016 KB |
Output is correct |
15 |
Correct |
15 ms |
6016 KB |
Output is correct |
16 |
Correct |
15 ms |
6016 KB |
Output is correct |
17 |
Correct |
14 ms |
6016 KB |
Output is correct |
18 |
Correct |
17 ms |
6016 KB |
Output is correct |
19 |
Correct |
17 ms |
6016 KB |
Output is correct |
20 |
Correct |
16 ms |
6016 KB |
Output is correct |
21 |
Correct |
16 ms |
6016 KB |
Output is correct |
22 |
Correct |
14 ms |
6016 KB |
Output is correct |
23 |
Correct |
14 ms |
6016 KB |
Output is correct |
24 |
Correct |
13 ms |
6016 KB |
Output is correct |
25 |
Correct |
14 ms |
6016 KB |
Output is correct |
26 |
Correct |
17 ms |
6016 KB |
Output is correct |
27 |
Correct |
16 ms |
6016 KB |
Output is correct |
28 |
Correct |
14 ms |
6016 KB |
Output is correct |
29 |
Execution timed out |
2059 ms |
13304 KB |
Time limit exceeded |
30 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
6016 KB |
Output is correct |
2 |
Correct |
5 ms |
6048 KB |
Output is correct |
3 |
Correct |
4 ms |
6016 KB |
Output is correct |
4 |
Correct |
4 ms |
6016 KB |
Output is correct |
5 |
Correct |
5 ms |
6016 KB |
Output is correct |
6 |
Correct |
5 ms |
6016 KB |
Output is correct |
7 |
Correct |
17 ms |
6016 KB |
Output is correct |
8 |
Correct |
15 ms |
6016 KB |
Output is correct |
9 |
Correct |
15 ms |
6016 KB |
Output is correct |
10 |
Correct |
14 ms |
6016 KB |
Output is correct |
11 |
Correct |
15 ms |
5964 KB |
Output is correct |
12 |
Correct |
15 ms |
6016 KB |
Output is correct |
13 |
Correct |
14 ms |
6016 KB |
Output is correct |
14 |
Correct |
15 ms |
6016 KB |
Output is correct |
15 |
Correct |
15 ms |
6016 KB |
Output is correct |
16 |
Correct |
15 ms |
6016 KB |
Output is correct |
17 |
Correct |
14 ms |
6016 KB |
Output is correct |
18 |
Correct |
17 ms |
6016 KB |
Output is correct |
19 |
Correct |
17 ms |
6016 KB |
Output is correct |
20 |
Correct |
16 ms |
6016 KB |
Output is correct |
21 |
Correct |
16 ms |
6016 KB |
Output is correct |
22 |
Correct |
14 ms |
6016 KB |
Output is correct |
23 |
Correct |
14 ms |
6016 KB |
Output is correct |
24 |
Correct |
13 ms |
6016 KB |
Output is correct |
25 |
Correct |
14 ms |
6016 KB |
Output is correct |
26 |
Correct |
17 ms |
6016 KB |
Output is correct |
27 |
Correct |
16 ms |
6016 KB |
Output is correct |
28 |
Correct |
14 ms |
6016 KB |
Output is correct |
29 |
Correct |
390 ms |
6100 KB |
Output is correct |
30 |
Correct |
593 ms |
6148 KB |
Output is correct |
31 |
Correct |
422 ms |
6156 KB |
Output is correct |
32 |
Correct |
273 ms |
6100 KB |
Output is correct |
33 |
Correct |
222 ms |
6144 KB |
Output is correct |
34 |
Correct |
560 ms |
6144 KB |
Output is correct |
35 |
Correct |
535 ms |
6144 KB |
Output is correct |
36 |
Correct |
208 ms |
6016 KB |
Output is correct |
37 |
Correct |
351 ms |
6144 KB |
Output is correct |
38 |
Correct |
301 ms |
6148 KB |
Output is correct |
39 |
Correct |
489 ms |
6152 KB |
Output is correct |
40 |
Correct |
265 ms |
6264 KB |
Output is correct |
41 |
Correct |
275 ms |
6136 KB |
Output is correct |
42 |
Correct |
282 ms |
6160 KB |
Output is correct |
43 |
Correct |
179 ms |
6144 KB |
Output is correct |
44 |
Correct |
220 ms |
6152 KB |
Output is correct |
45 |
Correct |
332 ms |
6152 KB |
Output is correct |
46 |
Correct |
431 ms |
6144 KB |
Output is correct |
47 |
Correct |
219 ms |
6264 KB |
Output is correct |
48 |
Correct |
244 ms |
6144 KB |
Output is correct |
49 |
Correct |
393 ms |
6148 KB |
Output is correct |
50 |
Correct |
538 ms |
6152 KB |
Output is correct |
51 |
Correct |
208 ms |
6144 KB |
Output is correct |
52 |
Correct |
268 ms |
6144 KB |
Output is correct |
53 |
Correct |
421 ms |
6264 KB |
Output is correct |
54 |
Correct |
656 ms |
6136 KB |
Output is correct |
55 |
Execution timed out |
2033 ms |
13104 KB |
Time limit exceeded |
56 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
6016 KB |
Output is correct |
2 |
Correct |
5 ms |
6048 KB |
Output is correct |
3 |
Correct |
4 ms |
6016 KB |
Output is correct |
4 |
Correct |
4 ms |
6016 KB |
Output is correct |
5 |
Correct |
5 ms |
6016 KB |
Output is correct |
6 |
Correct |
5 ms |
6016 KB |
Output is correct |
7 |
Correct |
17 ms |
6016 KB |
Output is correct |
8 |
Correct |
15 ms |
6016 KB |
Output is correct |
9 |
Correct |
15 ms |
6016 KB |
Output is correct |
10 |
Correct |
14 ms |
6016 KB |
Output is correct |
11 |
Correct |
15 ms |
5964 KB |
Output is correct |
12 |
Correct |
15 ms |
6016 KB |
Output is correct |
13 |
Correct |
14 ms |
6016 KB |
Output is correct |
14 |
Correct |
15 ms |
6016 KB |
Output is correct |
15 |
Correct |
15 ms |
6016 KB |
Output is correct |
16 |
Correct |
15 ms |
6016 KB |
Output is correct |
17 |
Correct |
14 ms |
6016 KB |
Output is correct |
18 |
Correct |
17 ms |
6016 KB |
Output is correct |
19 |
Correct |
17 ms |
6016 KB |
Output is correct |
20 |
Correct |
16 ms |
6016 KB |
Output is correct |
21 |
Correct |
16 ms |
6016 KB |
Output is correct |
22 |
Correct |
14 ms |
6016 KB |
Output is correct |
23 |
Correct |
14 ms |
6016 KB |
Output is correct |
24 |
Correct |
13 ms |
6016 KB |
Output is correct |
25 |
Correct |
14 ms |
6016 KB |
Output is correct |
26 |
Correct |
17 ms |
6016 KB |
Output is correct |
27 |
Correct |
16 ms |
6016 KB |
Output is correct |
28 |
Correct |
14 ms |
6016 KB |
Output is correct |
29 |
Correct |
390 ms |
6100 KB |
Output is correct |
30 |
Correct |
593 ms |
6148 KB |
Output is correct |
31 |
Correct |
422 ms |
6156 KB |
Output is correct |
32 |
Correct |
273 ms |
6100 KB |
Output is correct |
33 |
Correct |
222 ms |
6144 KB |
Output is correct |
34 |
Correct |
560 ms |
6144 KB |
Output is correct |
35 |
Correct |
535 ms |
6144 KB |
Output is correct |
36 |
Correct |
208 ms |
6016 KB |
Output is correct |
37 |
Correct |
351 ms |
6144 KB |
Output is correct |
38 |
Correct |
301 ms |
6148 KB |
Output is correct |
39 |
Correct |
489 ms |
6152 KB |
Output is correct |
40 |
Correct |
265 ms |
6264 KB |
Output is correct |
41 |
Correct |
275 ms |
6136 KB |
Output is correct |
42 |
Correct |
282 ms |
6160 KB |
Output is correct |
43 |
Correct |
179 ms |
6144 KB |
Output is correct |
44 |
Correct |
220 ms |
6152 KB |
Output is correct |
45 |
Correct |
332 ms |
6152 KB |
Output is correct |
46 |
Correct |
431 ms |
6144 KB |
Output is correct |
47 |
Correct |
219 ms |
6264 KB |
Output is correct |
48 |
Correct |
244 ms |
6144 KB |
Output is correct |
49 |
Correct |
393 ms |
6148 KB |
Output is correct |
50 |
Correct |
538 ms |
6152 KB |
Output is correct |
51 |
Correct |
208 ms |
6144 KB |
Output is correct |
52 |
Correct |
268 ms |
6144 KB |
Output is correct |
53 |
Correct |
421 ms |
6264 KB |
Output is correct |
54 |
Correct |
656 ms |
6136 KB |
Output is correct |
55 |
Execution timed out |
2059 ms |
13304 KB |
Time limit exceeded |
56 |
Halted |
0 ms |
0 KB |
- |