# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
914392 |
2024-01-21T21:38:08 Z |
Abito |
Joker (BOI20_joker) |
C++17 |
|
0 ms |
0 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,tin[N],t;
vector<pair<int,int>> adj[N];
bool vis[N],cyc;
void dfs(int x,int mid){
vis[x]=1;
tin[x]=++t;
for (auto u:adj[x]){
if (u.S>mid) continue;
if (vis[u.F]) cyc|=((tin[x]-tin[u.F]+1)&1);
else dfs(u.F,mid);
}t--;
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});
}
int l=1,r=m,mid,ans=m+1;
while (l<=r){
mid=(l+r)/2;
memset(vis,0,sizeof(vis));cyc=0;
memset(tin,0,sizeof(tin)));
for (int i=1;i<=n;i++) if (!vis[i]) dfs(i,mid);
if (cyc) ans=mid,r=mid-1;
else l=mid+1;
}
while (q--){
cin>>l>>r;
if (r>=ans) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
return 0;
}
Compilation message
Joker.cpp: In function 'int32_t main()':
Joker.cpp:58:34: error: expected ';' before ')' token
58 | memset(tin,0,sizeof(tin)));
| ^
| ;