# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
926463 |
2024-02-13T04:43:42 Z |
vjudge1 |
Joker (BOI20_joker) |
C++17 |
|
48 ms |
125776 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();
used[u[i]]=0;
used[v[i]]=0;
}
for(int i=r+1; i<=m; ++i){
g[u[i]].clear();
g[v[i]].clear();
used[u[i]]=0;
used[v[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 |
26 ms |
123740 KB |
Output is correct |
2 |
Correct |
25 ms |
123740 KB |
Output is correct |
3 |
Correct |
26 ms |
123736 KB |
Output is correct |
4 |
Correct |
28 ms |
123992 KB |
Output is correct |
5 |
Correct |
26 ms |
123740 KB |
Output is correct |
6 |
Incorrect |
26 ms |
123740 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
123740 KB |
Output is correct |
2 |
Correct |
25 ms |
123740 KB |
Output is correct |
3 |
Correct |
26 ms |
123736 KB |
Output is correct |
4 |
Correct |
28 ms |
123992 KB |
Output is correct |
5 |
Correct |
26 ms |
123740 KB |
Output is correct |
6 |
Incorrect |
26 ms |
123740 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
123740 KB |
Output is correct |
2 |
Correct |
25 ms |
123740 KB |
Output is correct |
3 |
Incorrect |
48 ms |
125776 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
123740 KB |
Output is correct |
2 |
Correct |
25 ms |
123740 KB |
Output is correct |
3 |
Correct |
26 ms |
123736 KB |
Output is correct |
4 |
Correct |
28 ms |
123992 KB |
Output is correct |
5 |
Correct |
26 ms |
123740 KB |
Output is correct |
6 |
Incorrect |
26 ms |
123740 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
123740 KB |
Output is correct |
2 |
Correct |
25 ms |
123740 KB |
Output is correct |
3 |
Correct |
26 ms |
123736 KB |
Output is correct |
4 |
Correct |
28 ms |
123992 KB |
Output is correct |
5 |
Correct |
26 ms |
123740 KB |
Output is correct |
6 |
Incorrect |
26 ms |
123740 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
123740 KB |
Output is correct |
2 |
Correct |
25 ms |
123740 KB |
Output is correct |
3 |
Correct |
26 ms |
123736 KB |
Output is correct |
4 |
Correct |
28 ms |
123992 KB |
Output is correct |
5 |
Correct |
26 ms |
123740 KB |
Output is correct |
6 |
Incorrect |
26 ms |
123740 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |