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>
#include <game.h>
using namespace std;
int r, n;
vector<int> a;
vector<bool> c;
void initialize(int nn){
r = 0;
n = nn;
a.resize(n, n - 1);
c.resize(n, 0);
}
int hasEdge(int u, int v){
a[u]--, a[v]--;
if(r == 0){
if(a[u] == 1 || a[v] == 1){
if(!c[u]) r++;
if(!c[v]) r++;
c[u] = c[v] = 1;
return 1;
}
}else if(r < n - 1){
if(a[u] == 2 || a[v] == 2){
if(!c[u]) r++;
if(!c[v]) r++;
c[u] = c[v] = 1;
return 1;
}
}else{
if(a[u] == 1 || a[v] == 1){
if(!c[u]) r++;
if(!c[v]) r++;
c[u] = c[v] = 1;
return 1;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |