# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
914213 |
2024-01-21T11:15:10 Z |
Abito |
Joker (BOI20_joker) |
C++14 |
|
2000 ms |
19156 KB |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
//#define int long long
#define ll long long
#define y1 YONE
#define free freeee
#define lcm llcm
/*
⠄⠄⠄⠄⢠⣿⣿⣿⣿⣿⢻⣿⣿⣿⣿⣿⣿⣿⣿⣯⢻⣿⣿⣿⣿⣆⠄⠄⠄
⠄⠄⣼⢀⣿⣿⣿⣿⣏⡏⠄⠹⣿⣿⣿⣿⣿⣿⣿⣿⣧⢻⣿⣿⣿⣿⡆⠄⠄
⠄⠄⡟⣼⣿⣿⣿⣿⣿⠄⠄⠄⠈⠻⣿⣿⣿⣿⣿⣿⣿⣇⢻⣿⣿⣿⣿⠄⠄
⠄⢰⠃⣿⣿⠿⣿⣿⣿⠄⠄⠄⠄⠄⠄⠙⠿⣿⣿⣿⣿⣿⠄⢿⣿⣿⣿⡄⠄
⠄⢸⢠⣿⣿⣧⡙⣿⣿⡆⠄⠄⠄⠄⠄⠄⠄⠈⠛⢿⣿⣿⡇⠸⣿⡿⣸⡇⠄
⠄⠈⡆⣿⣿⣿⣿⣦⡙⠳⠄⠄⠄⠄⠄⠄⢀⣠⣤⣀⣈⠙⠃⠄⠿⢇⣿⡇⠄
⠄⠄⡇⢿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⣠⣶⣿⣿⣿⣿⣿⣿⣷⣆⡀⣼⣿⡇⠄
⠄⠄⢹⡘⣿⣿⣿⢿⣷⡀⠄⢀⣴⣾⣟⠉⠉⠉⠉⣽⣿⣿⣿⣿⠇⢹⣿⠃⠄
⠄⠄⠄⢷⡘⢿⣿⣎⢻⣷⠰⣿⣿⣿⣿⣦⣀⣀⣴⣿⣿⣿⠟⢫⡾⢸⡟⠄.
⠄⠄⠄⠄⠻⣦⡙⠿⣧⠙⢷⠙⠻⠿⢿⡿⠿⠿⠛⠋⠉⠄⠂⠘⠁⠞⠄⠄⠄
⠄⠄⠄⠄⠄⠈⠙⠑⣠⣤⣴⡖⠄⠿⣋⣉⣉⡁⠄⢾⣦⠄⠄⠄⠄⠄⠄⠄⠄
*/
typedef unsigned long long ull;
using namespace std;
const int N=2e5+5;
int n,m,q,vis[N],tin[N],t,l,r;
vector<pair<int,int>> adj[N];
bool cyc;
void dfs(int x,int p){
//cout<<x<<' '<<p<<endl;
vis[x]=1;
tin[x]=++t;
for (auto u:adj[x]){
if (vis[u.F]==2 || u.F==p || (u.S>=l && u.S<=r)) continue;
if (vis[u.F]) cyc|=((tin[x]-tin[u.F]+1)&1);
else dfs(u.F,x);
}t--;
vis[x]++;
return;
}
int32_t main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
cin>>n>>m>>q;
for (int i=1;i<=m;i++){
int x,y;
cin>>x>>y;
adj[x].pb({y,i});
adj[y].pb({x,i});
}
while (q--){
cin>>l>>r;
memset(vis,0,sizeof(vis));cyc=0;
for (int i=1;i<=n;i++) if (!vis[i]) dfs(i,0);
if (cyc) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
5720 KB |
Output is correct |
2 |
Correct |
2 ms |
5724 KB |
Output is correct |
3 |
Correct |
2 ms |
5724 KB |
Output is correct |
4 |
Correct |
3 ms |
5932 KB |
Output is correct |
5 |
Correct |
2 ms |
5808 KB |
Output is correct |
6 |
Correct |
3 ms |
5724 KB |
Output is correct |
7 |
Correct |
5 ms |
5936 KB |
Output is correct |
8 |
Correct |
6 ms |
5720 KB |
Output is correct |
9 |
Correct |
5 ms |
5720 KB |
Output is correct |
10 |
Correct |
6 ms |
5724 KB |
Output is correct |
11 |
Correct |
5 ms |
5724 KB |
Output is correct |
12 |
Correct |
5 ms |
5724 KB |
Output is correct |
13 |
Correct |
6 ms |
5720 KB |
Output is correct |
14 |
Correct |
5 ms |
5724 KB |
Output is correct |
15 |
Correct |
6 ms |
5720 KB |
Output is correct |
16 |
Correct |
8 ms |
5724 KB |
Output is correct |
17 |
Correct |
5 ms |
5724 KB |
Output is correct |
18 |
Correct |
5 ms |
5976 KB |
Output is correct |
19 |
Correct |
5 ms |
5724 KB |
Output is correct |
20 |
Correct |
6 ms |
5720 KB |
Output is correct |
21 |
Correct |
5 ms |
5724 KB |
Output is correct |
22 |
Correct |
5 ms |
5720 KB |
Output is correct |
23 |
Correct |
5 ms |
5928 KB |
Output is correct |
24 |
Correct |
6 ms |
5724 KB |
Output is correct |
25 |
Correct |
5 ms |
5724 KB |
Output is correct |
26 |
Correct |
5 ms |
5724 KB |
Output is correct |
27 |
Correct |
5 ms |
5724 KB |
Output is correct |
28 |
Correct |
6 ms |
5724 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
5720 KB |
Output is correct |
2 |
Correct |
2 ms |
5724 KB |
Output is correct |
3 |
Correct |
2 ms |
5724 KB |
Output is correct |
4 |
Correct |
3 ms |
5932 KB |
Output is correct |
5 |
Correct |
2 ms |
5808 KB |
Output is correct |
6 |
Correct |
3 ms |
5724 KB |
Output is correct |
7 |
Correct |
5 ms |
5936 KB |
Output is correct |
8 |
Correct |
6 ms |
5720 KB |
Output is correct |
9 |
Correct |
5 ms |
5720 KB |
Output is correct |
10 |
Correct |
6 ms |
5724 KB |
Output is correct |
11 |
Correct |
5 ms |
5724 KB |
Output is correct |
12 |
Correct |
5 ms |
5724 KB |
Output is correct |
13 |
Correct |
6 ms |
5720 KB |
Output is correct |
14 |
Correct |
5 ms |
5724 KB |
Output is correct |
15 |
Correct |
6 ms |
5720 KB |
Output is correct |
16 |
Correct |
8 ms |
5724 KB |
Output is correct |
17 |
Correct |
5 ms |
5724 KB |
Output is correct |
18 |
Correct |
5 ms |
5976 KB |
Output is correct |
19 |
Correct |
5 ms |
5724 KB |
Output is correct |
20 |
Correct |
6 ms |
5720 KB |
Output is correct |
21 |
Correct |
5 ms |
5724 KB |
Output is correct |
22 |
Correct |
5 ms |
5720 KB |
Output is correct |
23 |
Correct |
5 ms |
5928 KB |
Output is correct |
24 |
Correct |
6 ms |
5724 KB |
Output is correct |
25 |
Correct |
5 ms |
5724 KB |
Output is correct |
26 |
Correct |
5 ms |
5724 KB |
Output is correct |
27 |
Correct |
5 ms |
5724 KB |
Output is correct |
28 |
Correct |
6 ms |
5724 KB |
Output is correct |
29 |
Correct |
87 ms |
6004 KB |
Output is correct |
30 |
Correct |
142 ms |
6176 KB |
Output is correct |
31 |
Correct |
140 ms |
6068 KB |
Output is correct |
32 |
Correct |
124 ms |
6064 KB |
Output is correct |
33 |
Correct |
104 ms |
5980 KB |
Output is correct |
34 |
Correct |
154 ms |
6060 KB |
Output is correct |
35 |
Correct |
154 ms |
6064 KB |
Output is correct |
36 |
Correct |
64 ms |
6224 KB |
Output is correct |
37 |
Correct |
99 ms |
5980 KB |
Output is correct |
38 |
Correct |
86 ms |
5980 KB |
Output is correct |
39 |
Correct |
114 ms |
6060 KB |
Output is correct |
40 |
Correct |
114 ms |
6332 KB |
Output is correct |
41 |
Correct |
119 ms |
5980 KB |
Output is correct |
42 |
Correct |
118 ms |
6080 KB |
Output is correct |
43 |
Correct |
96 ms |
5976 KB |
Output is correct |
44 |
Correct |
120 ms |
6092 KB |
Output is correct |
45 |
Correct |
136 ms |
6232 KB |
Output is correct |
46 |
Correct |
148 ms |
6068 KB |
Output is correct |
47 |
Correct |
112 ms |
6052 KB |
Output is correct |
48 |
Correct |
117 ms |
6228 KB |
Output is correct |
49 |
Correct |
131 ms |
5980 KB |
Output is correct |
50 |
Correct |
142 ms |
5980 KB |
Output is correct |
51 |
Correct |
111 ms |
5980 KB |
Output is correct |
52 |
Correct |
125 ms |
6320 KB |
Output is correct |
53 |
Correct |
135 ms |
5980 KB |
Output is correct |
54 |
Correct |
152 ms |
6068 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
5720 KB |
Output is correct |
2 |
Correct |
2 ms |
5724 KB |
Output is correct |
3 |
Execution timed out |
2067 ms |
17744 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
5720 KB |
Output is correct |
2 |
Correct |
2 ms |
5724 KB |
Output is correct |
3 |
Correct |
2 ms |
5724 KB |
Output is correct |
4 |
Correct |
3 ms |
5932 KB |
Output is correct |
5 |
Correct |
2 ms |
5808 KB |
Output is correct |
6 |
Correct |
3 ms |
5724 KB |
Output is correct |
7 |
Correct |
5 ms |
5936 KB |
Output is correct |
8 |
Correct |
6 ms |
5720 KB |
Output is correct |
9 |
Correct |
5 ms |
5720 KB |
Output is correct |
10 |
Correct |
6 ms |
5724 KB |
Output is correct |
11 |
Correct |
5 ms |
5724 KB |
Output is correct |
12 |
Correct |
5 ms |
5724 KB |
Output is correct |
13 |
Correct |
6 ms |
5720 KB |
Output is correct |
14 |
Correct |
5 ms |
5724 KB |
Output is correct |
15 |
Correct |
6 ms |
5720 KB |
Output is correct |
16 |
Correct |
8 ms |
5724 KB |
Output is correct |
17 |
Correct |
5 ms |
5724 KB |
Output is correct |
18 |
Correct |
5 ms |
5976 KB |
Output is correct |
19 |
Correct |
5 ms |
5724 KB |
Output is correct |
20 |
Correct |
6 ms |
5720 KB |
Output is correct |
21 |
Correct |
5 ms |
5724 KB |
Output is correct |
22 |
Correct |
5 ms |
5720 KB |
Output is correct |
23 |
Correct |
5 ms |
5928 KB |
Output is correct |
24 |
Correct |
6 ms |
5724 KB |
Output is correct |
25 |
Correct |
5 ms |
5724 KB |
Output is correct |
26 |
Correct |
5 ms |
5724 KB |
Output is correct |
27 |
Correct |
5 ms |
5724 KB |
Output is correct |
28 |
Correct |
6 ms |
5724 KB |
Output is correct |
29 |
Execution timed out |
2067 ms |
17744 KB |
Time limit exceeded |
30 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
5720 KB |
Output is correct |
2 |
Correct |
2 ms |
5724 KB |
Output is correct |
3 |
Correct |
2 ms |
5724 KB |
Output is correct |
4 |
Correct |
3 ms |
5932 KB |
Output is correct |
5 |
Correct |
2 ms |
5808 KB |
Output is correct |
6 |
Correct |
3 ms |
5724 KB |
Output is correct |
7 |
Correct |
5 ms |
5936 KB |
Output is correct |
8 |
Correct |
6 ms |
5720 KB |
Output is correct |
9 |
Correct |
5 ms |
5720 KB |
Output is correct |
10 |
Correct |
6 ms |
5724 KB |
Output is correct |
11 |
Correct |
5 ms |
5724 KB |
Output is correct |
12 |
Correct |
5 ms |
5724 KB |
Output is correct |
13 |
Correct |
6 ms |
5720 KB |
Output is correct |
14 |
Correct |
5 ms |
5724 KB |
Output is correct |
15 |
Correct |
6 ms |
5720 KB |
Output is correct |
16 |
Correct |
8 ms |
5724 KB |
Output is correct |
17 |
Correct |
5 ms |
5724 KB |
Output is correct |
18 |
Correct |
5 ms |
5976 KB |
Output is correct |
19 |
Correct |
5 ms |
5724 KB |
Output is correct |
20 |
Correct |
6 ms |
5720 KB |
Output is correct |
21 |
Correct |
5 ms |
5724 KB |
Output is correct |
22 |
Correct |
5 ms |
5720 KB |
Output is correct |
23 |
Correct |
5 ms |
5928 KB |
Output is correct |
24 |
Correct |
6 ms |
5724 KB |
Output is correct |
25 |
Correct |
5 ms |
5724 KB |
Output is correct |
26 |
Correct |
5 ms |
5724 KB |
Output is correct |
27 |
Correct |
5 ms |
5724 KB |
Output is correct |
28 |
Correct |
6 ms |
5724 KB |
Output is correct |
29 |
Correct |
87 ms |
6004 KB |
Output is correct |
30 |
Correct |
142 ms |
6176 KB |
Output is correct |
31 |
Correct |
140 ms |
6068 KB |
Output is correct |
32 |
Correct |
124 ms |
6064 KB |
Output is correct |
33 |
Correct |
104 ms |
5980 KB |
Output is correct |
34 |
Correct |
154 ms |
6060 KB |
Output is correct |
35 |
Correct |
154 ms |
6064 KB |
Output is correct |
36 |
Correct |
64 ms |
6224 KB |
Output is correct |
37 |
Correct |
99 ms |
5980 KB |
Output is correct |
38 |
Correct |
86 ms |
5980 KB |
Output is correct |
39 |
Correct |
114 ms |
6060 KB |
Output is correct |
40 |
Correct |
114 ms |
6332 KB |
Output is correct |
41 |
Correct |
119 ms |
5980 KB |
Output is correct |
42 |
Correct |
118 ms |
6080 KB |
Output is correct |
43 |
Correct |
96 ms |
5976 KB |
Output is correct |
44 |
Correct |
120 ms |
6092 KB |
Output is correct |
45 |
Correct |
136 ms |
6232 KB |
Output is correct |
46 |
Correct |
148 ms |
6068 KB |
Output is correct |
47 |
Correct |
112 ms |
6052 KB |
Output is correct |
48 |
Correct |
117 ms |
6228 KB |
Output is correct |
49 |
Correct |
131 ms |
5980 KB |
Output is correct |
50 |
Correct |
142 ms |
5980 KB |
Output is correct |
51 |
Correct |
111 ms |
5980 KB |
Output is correct |
52 |
Correct |
125 ms |
6320 KB |
Output is correct |
53 |
Correct |
135 ms |
5980 KB |
Output is correct |
54 |
Correct |
152 ms |
6068 KB |
Output is correct |
55 |
Execution timed out |
2027 ms |
19156 KB |
Time limit exceeded |
56 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
5720 KB |
Output is correct |
2 |
Correct |
2 ms |
5724 KB |
Output is correct |
3 |
Correct |
2 ms |
5724 KB |
Output is correct |
4 |
Correct |
3 ms |
5932 KB |
Output is correct |
5 |
Correct |
2 ms |
5808 KB |
Output is correct |
6 |
Correct |
3 ms |
5724 KB |
Output is correct |
7 |
Correct |
5 ms |
5936 KB |
Output is correct |
8 |
Correct |
6 ms |
5720 KB |
Output is correct |
9 |
Correct |
5 ms |
5720 KB |
Output is correct |
10 |
Correct |
6 ms |
5724 KB |
Output is correct |
11 |
Correct |
5 ms |
5724 KB |
Output is correct |
12 |
Correct |
5 ms |
5724 KB |
Output is correct |
13 |
Correct |
6 ms |
5720 KB |
Output is correct |
14 |
Correct |
5 ms |
5724 KB |
Output is correct |
15 |
Correct |
6 ms |
5720 KB |
Output is correct |
16 |
Correct |
8 ms |
5724 KB |
Output is correct |
17 |
Correct |
5 ms |
5724 KB |
Output is correct |
18 |
Correct |
5 ms |
5976 KB |
Output is correct |
19 |
Correct |
5 ms |
5724 KB |
Output is correct |
20 |
Correct |
6 ms |
5720 KB |
Output is correct |
21 |
Correct |
5 ms |
5724 KB |
Output is correct |
22 |
Correct |
5 ms |
5720 KB |
Output is correct |
23 |
Correct |
5 ms |
5928 KB |
Output is correct |
24 |
Correct |
6 ms |
5724 KB |
Output is correct |
25 |
Correct |
5 ms |
5724 KB |
Output is correct |
26 |
Correct |
5 ms |
5724 KB |
Output is correct |
27 |
Correct |
5 ms |
5724 KB |
Output is correct |
28 |
Correct |
6 ms |
5724 KB |
Output is correct |
29 |
Correct |
87 ms |
6004 KB |
Output is correct |
30 |
Correct |
142 ms |
6176 KB |
Output is correct |
31 |
Correct |
140 ms |
6068 KB |
Output is correct |
32 |
Correct |
124 ms |
6064 KB |
Output is correct |
33 |
Correct |
104 ms |
5980 KB |
Output is correct |
34 |
Correct |
154 ms |
6060 KB |
Output is correct |
35 |
Correct |
154 ms |
6064 KB |
Output is correct |
36 |
Correct |
64 ms |
6224 KB |
Output is correct |
37 |
Correct |
99 ms |
5980 KB |
Output is correct |
38 |
Correct |
86 ms |
5980 KB |
Output is correct |
39 |
Correct |
114 ms |
6060 KB |
Output is correct |
40 |
Correct |
114 ms |
6332 KB |
Output is correct |
41 |
Correct |
119 ms |
5980 KB |
Output is correct |
42 |
Correct |
118 ms |
6080 KB |
Output is correct |
43 |
Correct |
96 ms |
5976 KB |
Output is correct |
44 |
Correct |
120 ms |
6092 KB |
Output is correct |
45 |
Correct |
136 ms |
6232 KB |
Output is correct |
46 |
Correct |
148 ms |
6068 KB |
Output is correct |
47 |
Correct |
112 ms |
6052 KB |
Output is correct |
48 |
Correct |
117 ms |
6228 KB |
Output is correct |
49 |
Correct |
131 ms |
5980 KB |
Output is correct |
50 |
Correct |
142 ms |
5980 KB |
Output is correct |
51 |
Correct |
111 ms |
5980 KB |
Output is correct |
52 |
Correct |
125 ms |
6320 KB |
Output is correct |
53 |
Correct |
135 ms |
5980 KB |
Output is correct |
54 |
Correct |
152 ms |
6068 KB |
Output is correct |
55 |
Execution timed out |
2067 ms |
17744 KB |
Time limit exceeded |
56 |
Halted |
0 ms |
0 KB |
- |