# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
926465 |
2024-02-13T04:46:13 Z |
vjudge1 |
Joker (BOI20_joker) |
C++17 |
|
136 ms |
125784 KB |
#include <bits/stdc++.h>
using namespace std;
#define all(a) a.begin(),a.end()
#define pb push_back
#define vt vector
#define endl '\n'
typedef long long ll;
const ll mod=1e9+7;
const ll inf=mod;
const int N=5e6+4;
string ans;
int n,m,q,u[N],v[N],used[N];
vt<int>g[N];
void dfs(int v,int val=1){
used[v]=val;
// cout<<v<<' '<<used[v]<<endl;
for(int to:g[v]) {
if(!used[to]) dfs(to,3-val);
if(used[to]==used[v]){
ans="YES";
}
}
}
void solve(){
cin>>n>>m>>q;
for(int i=1; i<=m; ++i){
cin>>u[i]>>v[i];
}
if(max({n,m,q})<=2000){
while(q--){
int l,r;
cin>>l>>r;
for(int i=1; i<l; ++i){
g[u[i]].pb(v[i]);
g[v[i]].pb(u[i]);
}
for(int i=r+1; i<=m; ++i){
g[u[i]].pb(v[i]);
g[v[i]].pb(u[i]);
}
ans="NO";
for(int i=1; i<=n; ++i) if(!used[i]) dfs(i);
cout<<ans<<endl;
for(int i=1; i<l; ++i){
g[u[i]].clear();
g[v[i]].clear();
}
for(int i=r+1; i<=m; ++i){
g[u[i]].clear();
g[v[i]].clear();
}
for(int i=1; i<=n; ++i) used[i]=0;
}
}
}
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int tt=1;
// cin>>tt;
while(tt--) {
solve();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
123740 KB |
Output is correct |
2 |
Correct |
26 ms |
123740 KB |
Output is correct |
3 |
Correct |
25 ms |
123740 KB |
Output is correct |
4 |
Correct |
26 ms |
123560 KB |
Output is correct |
5 |
Correct |
26 ms |
123624 KB |
Output is correct |
6 |
Correct |
26 ms |
123740 KB |
Output is correct |
7 |
Correct |
26 ms |
123736 KB |
Output is correct |
8 |
Correct |
27 ms |
123736 KB |
Output is correct |
9 |
Correct |
27 ms |
123740 KB |
Output is correct |
10 |
Correct |
27 ms |
123736 KB |
Output is correct |
11 |
Correct |
27 ms |
123740 KB |
Output is correct |
12 |
Correct |
26 ms |
123736 KB |
Output is correct |
13 |
Correct |
26 ms |
123740 KB |
Output is correct |
14 |
Correct |
27 ms |
123740 KB |
Output is correct |
15 |
Correct |
26 ms |
123736 KB |
Output is correct |
16 |
Correct |
26 ms |
123740 KB |
Output is correct |
17 |
Correct |
27 ms |
123740 KB |
Output is correct |
18 |
Correct |
26 ms |
123772 KB |
Output is correct |
19 |
Correct |
26 ms |
123740 KB |
Output is correct |
20 |
Correct |
27 ms |
123584 KB |
Output is correct |
21 |
Correct |
27 ms |
123696 KB |
Output is correct |
22 |
Correct |
27 ms |
123736 KB |
Output is correct |
23 |
Correct |
26 ms |
123736 KB |
Output is correct |
24 |
Correct |
27 ms |
123740 KB |
Output is correct |
25 |
Correct |
27 ms |
123740 KB |
Output is correct |
26 |
Correct |
28 ms |
123940 KB |
Output is correct |
27 |
Correct |
27 ms |
123740 KB |
Output is correct |
28 |
Correct |
33 ms |
123736 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
123740 KB |
Output is correct |
2 |
Correct |
26 ms |
123740 KB |
Output is correct |
3 |
Correct |
25 ms |
123740 KB |
Output is correct |
4 |
Correct |
26 ms |
123560 KB |
Output is correct |
5 |
Correct |
26 ms |
123624 KB |
Output is correct |
6 |
Correct |
26 ms |
123740 KB |
Output is correct |
7 |
Correct |
26 ms |
123736 KB |
Output is correct |
8 |
Correct |
27 ms |
123736 KB |
Output is correct |
9 |
Correct |
27 ms |
123740 KB |
Output is correct |
10 |
Correct |
27 ms |
123736 KB |
Output is correct |
11 |
Correct |
27 ms |
123740 KB |
Output is correct |
12 |
Correct |
26 ms |
123736 KB |
Output is correct |
13 |
Correct |
26 ms |
123740 KB |
Output is correct |
14 |
Correct |
27 ms |
123740 KB |
Output is correct |
15 |
Correct |
26 ms |
123736 KB |
Output is correct |
16 |
Correct |
26 ms |
123740 KB |
Output is correct |
17 |
Correct |
27 ms |
123740 KB |
Output is correct |
18 |
Correct |
26 ms |
123772 KB |
Output is correct |
19 |
Correct |
26 ms |
123740 KB |
Output is correct |
20 |
Correct |
27 ms |
123584 KB |
Output is correct |
21 |
Correct |
27 ms |
123696 KB |
Output is correct |
22 |
Correct |
27 ms |
123736 KB |
Output is correct |
23 |
Correct |
26 ms |
123736 KB |
Output is correct |
24 |
Correct |
27 ms |
123740 KB |
Output is correct |
25 |
Correct |
27 ms |
123740 KB |
Output is correct |
26 |
Correct |
28 ms |
123940 KB |
Output is correct |
27 |
Correct |
27 ms |
123740 KB |
Output is correct |
28 |
Correct |
33 ms |
123736 KB |
Output is correct |
29 |
Correct |
72 ms |
123800 KB |
Output is correct |
30 |
Correct |
117 ms |
123828 KB |
Output is correct |
31 |
Correct |
116 ms |
123740 KB |
Output is correct |
32 |
Correct |
101 ms |
123728 KB |
Output is correct |
33 |
Correct |
92 ms |
123736 KB |
Output is correct |
34 |
Correct |
121 ms |
123732 KB |
Output is correct |
35 |
Correct |
126 ms |
123736 KB |
Output is correct |
36 |
Correct |
70 ms |
123740 KB |
Output is correct |
37 |
Correct |
98 ms |
123736 KB |
Output is correct |
38 |
Correct |
93 ms |
123996 KB |
Output is correct |
39 |
Correct |
93 ms |
123828 KB |
Output is correct |
40 |
Correct |
95 ms |
123740 KB |
Output is correct |
41 |
Correct |
96 ms |
123740 KB |
Output is correct |
42 |
Correct |
94 ms |
123832 KB |
Output is correct |
43 |
Correct |
117 ms |
123988 KB |
Output is correct |
44 |
Correct |
127 ms |
123740 KB |
Output is correct |
45 |
Correct |
134 ms |
123824 KB |
Output is correct |
46 |
Correct |
136 ms |
123832 KB |
Output is correct |
47 |
Correct |
98 ms |
123740 KB |
Output is correct |
48 |
Correct |
99 ms |
123740 KB |
Output is correct |
49 |
Correct |
108 ms |
123816 KB |
Output is correct |
50 |
Correct |
120 ms |
123736 KB |
Output is correct |
51 |
Correct |
96 ms |
123984 KB |
Output is correct |
52 |
Correct |
101 ms |
124012 KB |
Output is correct |
53 |
Correct |
111 ms |
123836 KB |
Output is correct |
54 |
Correct |
124 ms |
123836 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
123740 KB |
Output is correct |
2 |
Correct |
26 ms |
123740 KB |
Output is correct |
3 |
Incorrect |
47 ms |
125780 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
123740 KB |
Output is correct |
2 |
Correct |
26 ms |
123740 KB |
Output is correct |
3 |
Correct |
25 ms |
123740 KB |
Output is correct |
4 |
Correct |
26 ms |
123560 KB |
Output is correct |
5 |
Correct |
26 ms |
123624 KB |
Output is correct |
6 |
Correct |
26 ms |
123740 KB |
Output is correct |
7 |
Correct |
26 ms |
123736 KB |
Output is correct |
8 |
Correct |
27 ms |
123736 KB |
Output is correct |
9 |
Correct |
27 ms |
123740 KB |
Output is correct |
10 |
Correct |
27 ms |
123736 KB |
Output is correct |
11 |
Correct |
27 ms |
123740 KB |
Output is correct |
12 |
Correct |
26 ms |
123736 KB |
Output is correct |
13 |
Correct |
26 ms |
123740 KB |
Output is correct |
14 |
Correct |
27 ms |
123740 KB |
Output is correct |
15 |
Correct |
26 ms |
123736 KB |
Output is correct |
16 |
Correct |
26 ms |
123740 KB |
Output is correct |
17 |
Correct |
27 ms |
123740 KB |
Output is correct |
18 |
Correct |
26 ms |
123772 KB |
Output is correct |
19 |
Correct |
26 ms |
123740 KB |
Output is correct |
20 |
Correct |
27 ms |
123584 KB |
Output is correct |
21 |
Correct |
27 ms |
123696 KB |
Output is correct |
22 |
Correct |
27 ms |
123736 KB |
Output is correct |
23 |
Correct |
26 ms |
123736 KB |
Output is correct |
24 |
Correct |
27 ms |
123740 KB |
Output is correct |
25 |
Correct |
27 ms |
123740 KB |
Output is correct |
26 |
Correct |
28 ms |
123940 KB |
Output is correct |
27 |
Correct |
27 ms |
123740 KB |
Output is correct |
28 |
Correct |
33 ms |
123736 KB |
Output is correct |
29 |
Incorrect |
47 ms |
125780 KB |
Output isn't correct |
30 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
123740 KB |
Output is correct |
2 |
Correct |
26 ms |
123740 KB |
Output is correct |
3 |
Correct |
25 ms |
123740 KB |
Output is correct |
4 |
Correct |
26 ms |
123560 KB |
Output is correct |
5 |
Correct |
26 ms |
123624 KB |
Output is correct |
6 |
Correct |
26 ms |
123740 KB |
Output is correct |
7 |
Correct |
26 ms |
123736 KB |
Output is correct |
8 |
Correct |
27 ms |
123736 KB |
Output is correct |
9 |
Correct |
27 ms |
123740 KB |
Output is correct |
10 |
Correct |
27 ms |
123736 KB |
Output is correct |
11 |
Correct |
27 ms |
123740 KB |
Output is correct |
12 |
Correct |
26 ms |
123736 KB |
Output is correct |
13 |
Correct |
26 ms |
123740 KB |
Output is correct |
14 |
Correct |
27 ms |
123740 KB |
Output is correct |
15 |
Correct |
26 ms |
123736 KB |
Output is correct |
16 |
Correct |
26 ms |
123740 KB |
Output is correct |
17 |
Correct |
27 ms |
123740 KB |
Output is correct |
18 |
Correct |
26 ms |
123772 KB |
Output is correct |
19 |
Correct |
26 ms |
123740 KB |
Output is correct |
20 |
Correct |
27 ms |
123584 KB |
Output is correct |
21 |
Correct |
27 ms |
123696 KB |
Output is correct |
22 |
Correct |
27 ms |
123736 KB |
Output is correct |
23 |
Correct |
26 ms |
123736 KB |
Output is correct |
24 |
Correct |
27 ms |
123740 KB |
Output is correct |
25 |
Correct |
27 ms |
123740 KB |
Output is correct |
26 |
Correct |
28 ms |
123940 KB |
Output is correct |
27 |
Correct |
27 ms |
123740 KB |
Output is correct |
28 |
Correct |
33 ms |
123736 KB |
Output is correct |
29 |
Correct |
72 ms |
123800 KB |
Output is correct |
30 |
Correct |
117 ms |
123828 KB |
Output is correct |
31 |
Correct |
116 ms |
123740 KB |
Output is correct |
32 |
Correct |
101 ms |
123728 KB |
Output is correct |
33 |
Correct |
92 ms |
123736 KB |
Output is correct |
34 |
Correct |
121 ms |
123732 KB |
Output is correct |
35 |
Correct |
126 ms |
123736 KB |
Output is correct |
36 |
Correct |
70 ms |
123740 KB |
Output is correct |
37 |
Correct |
98 ms |
123736 KB |
Output is correct |
38 |
Correct |
93 ms |
123996 KB |
Output is correct |
39 |
Correct |
93 ms |
123828 KB |
Output is correct |
40 |
Correct |
95 ms |
123740 KB |
Output is correct |
41 |
Correct |
96 ms |
123740 KB |
Output is correct |
42 |
Correct |
94 ms |
123832 KB |
Output is correct |
43 |
Correct |
117 ms |
123988 KB |
Output is correct |
44 |
Correct |
127 ms |
123740 KB |
Output is correct |
45 |
Correct |
134 ms |
123824 KB |
Output is correct |
46 |
Correct |
136 ms |
123832 KB |
Output is correct |
47 |
Correct |
98 ms |
123740 KB |
Output is correct |
48 |
Correct |
99 ms |
123740 KB |
Output is correct |
49 |
Correct |
108 ms |
123816 KB |
Output is correct |
50 |
Correct |
120 ms |
123736 KB |
Output is correct |
51 |
Correct |
96 ms |
123984 KB |
Output is correct |
52 |
Correct |
101 ms |
124012 KB |
Output is correct |
53 |
Correct |
111 ms |
123836 KB |
Output is correct |
54 |
Correct |
124 ms |
123836 KB |
Output is correct |
55 |
Incorrect |
47 ms |
125784 KB |
Output isn't correct |
56 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
123740 KB |
Output is correct |
2 |
Correct |
26 ms |
123740 KB |
Output is correct |
3 |
Correct |
25 ms |
123740 KB |
Output is correct |
4 |
Correct |
26 ms |
123560 KB |
Output is correct |
5 |
Correct |
26 ms |
123624 KB |
Output is correct |
6 |
Correct |
26 ms |
123740 KB |
Output is correct |
7 |
Correct |
26 ms |
123736 KB |
Output is correct |
8 |
Correct |
27 ms |
123736 KB |
Output is correct |
9 |
Correct |
27 ms |
123740 KB |
Output is correct |
10 |
Correct |
27 ms |
123736 KB |
Output is correct |
11 |
Correct |
27 ms |
123740 KB |
Output is correct |
12 |
Correct |
26 ms |
123736 KB |
Output is correct |
13 |
Correct |
26 ms |
123740 KB |
Output is correct |
14 |
Correct |
27 ms |
123740 KB |
Output is correct |
15 |
Correct |
26 ms |
123736 KB |
Output is correct |
16 |
Correct |
26 ms |
123740 KB |
Output is correct |
17 |
Correct |
27 ms |
123740 KB |
Output is correct |
18 |
Correct |
26 ms |
123772 KB |
Output is correct |
19 |
Correct |
26 ms |
123740 KB |
Output is correct |
20 |
Correct |
27 ms |
123584 KB |
Output is correct |
21 |
Correct |
27 ms |
123696 KB |
Output is correct |
22 |
Correct |
27 ms |
123736 KB |
Output is correct |
23 |
Correct |
26 ms |
123736 KB |
Output is correct |
24 |
Correct |
27 ms |
123740 KB |
Output is correct |
25 |
Correct |
27 ms |
123740 KB |
Output is correct |
26 |
Correct |
28 ms |
123940 KB |
Output is correct |
27 |
Correct |
27 ms |
123740 KB |
Output is correct |
28 |
Correct |
33 ms |
123736 KB |
Output is correct |
29 |
Correct |
72 ms |
123800 KB |
Output is correct |
30 |
Correct |
117 ms |
123828 KB |
Output is correct |
31 |
Correct |
116 ms |
123740 KB |
Output is correct |
32 |
Correct |
101 ms |
123728 KB |
Output is correct |
33 |
Correct |
92 ms |
123736 KB |
Output is correct |
34 |
Correct |
121 ms |
123732 KB |
Output is correct |
35 |
Correct |
126 ms |
123736 KB |
Output is correct |
36 |
Correct |
70 ms |
123740 KB |
Output is correct |
37 |
Correct |
98 ms |
123736 KB |
Output is correct |
38 |
Correct |
93 ms |
123996 KB |
Output is correct |
39 |
Correct |
93 ms |
123828 KB |
Output is correct |
40 |
Correct |
95 ms |
123740 KB |
Output is correct |
41 |
Correct |
96 ms |
123740 KB |
Output is correct |
42 |
Correct |
94 ms |
123832 KB |
Output is correct |
43 |
Correct |
117 ms |
123988 KB |
Output is correct |
44 |
Correct |
127 ms |
123740 KB |
Output is correct |
45 |
Correct |
134 ms |
123824 KB |
Output is correct |
46 |
Correct |
136 ms |
123832 KB |
Output is correct |
47 |
Correct |
98 ms |
123740 KB |
Output is correct |
48 |
Correct |
99 ms |
123740 KB |
Output is correct |
49 |
Correct |
108 ms |
123816 KB |
Output is correct |
50 |
Correct |
120 ms |
123736 KB |
Output is correct |
51 |
Correct |
96 ms |
123984 KB |
Output is correct |
52 |
Correct |
101 ms |
124012 KB |
Output is correct |
53 |
Correct |
111 ms |
123836 KB |
Output is correct |
54 |
Correct |
124 ms |
123836 KB |
Output is correct |
55 |
Incorrect |
47 ms |
125780 KB |
Output isn't correct |
56 |
Halted |
0 ms |
0 KB |
- |