#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
244 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |