This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
int n;
vector<set<int>> gr;
void initialize(int N){
n=N;
gr.resize(n);
for(int i=0; i<n; i++){
for(int j=i+1; j<n; j++){
gr[i].insert(j);
gr[j].insert(i);
}
}
}
int hasEdge(int u, int v){
vector<bool> seen(n,0);
queue<int> q;
q.push(u);
seen[u]=1;
while(!q.empty()){
auto t=q.front();
q.pop();
if(t==v){
gr[u].erase(v);
gr[v].erase(u);
return 0;
}
for(auto i:gr[t]){
if(t==u && i==v) continue;
if(!seen[i]){
seen[i]=1;
q.push(i);
}
}
}
return 1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |