Submission #701396

#TimeUsernameProblemLanguageResultExecution timeMemory
701396mychecksedad게임 (IOI14_game)C++17
0 / 100
1 ms212 KiB
#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(c[u] && c[v]){
		return 0;
	}
	if(r == 0){
		if(a[u] == 0 || a[v] == 0){
			if(!c[u]) r++;
			if(!c[v]) r++;
			c[u] = c[v] = 1;
			return 1;
		}
	}else if(r < n - 1){
		if(a[u] == 1 || a[v] == 1){
			if(!c[u]) r++;
			if(!c[v]) r++;
			c[u] = c[v] = 1;
			return 1;
		}
	}else{
		if(a[u] == 0 || a[v] == 0){
			if(!c[u]) r++;
			if(!c[v]) r++;
			c[u] = c[v] = 1;
			return 1;
		}
	}
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...