Submission #763137

#TimeUsernameProblemLanguageResultExecution timeMemory
763137SanguineChameleon게임 (IOI14_game)C++17
42 / 100
1083 ms18936 KiB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;

const int maxn = 1.5e3 + 20;
bool done[maxn][maxn];
int color[maxn][maxn];
int cnt[maxn];
int t = 0;
int n;

void initialize(int _n) {
	n = _n;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			color[i][j] = -1;
		}
	}
}

int hasEdge(int u, int v) {
	if (u > v) {
		swap(u, v);
	}
	if (u + 1 == v) {
		for (int i = 0; i <= u; i++) {
			for (int j = v; j < n; j++) {
				if (!done[i][j] && color[i][j] == -1) {
					color[i][j] = u;
					cnt[u]++;
				}
			}
		}
	}
	done[u][v] = true;
	if (color[u][v] == -1) {
		return 0;
	}
	cnt[color[u][v]]--;
	if (cnt[color[u][v]] == 0) {
		return 1;
	}
	else {
		return 0;
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...