Submission #414710

#TimeUsernameProblemLanguageResultExecution timeMemory
414710hibye1217Game (IOI14_game)C++17
42 / 100
45 ms2036 KiB
#ifndef NOTSUBMIT
#include <bits/stdc++.h>
#include "game.h"
using namespace std;
#endif // NOTSUBMIT

// Subtask 1 2

int nc;
int adj[90][90];

int cnt = 0;
bool chk[90];
void dfs(int now){
	chk[now] = 1; cnt += 1;
	for (int nxt = 1; nxt <= nc; nxt++){
		if (chk[nxt] || !adj[now][nxt]){ continue; }
		dfs(nxt);
	}
}

void initialize(int n) {
	nc = n;
	for (int i = 1; i <= n; i++){
		for (int j = 1; j <= n; j++){
			adj[i][j] = 1;
		}
	}
}

int hasEdge(int u, int v) { u += 1; v += 1;
	adj[u][v] = adj[v][u] = 0;
	cnt = 0; memset(chk, 0, sizeof(chk));
	dfs(u);
	if (cnt != nc){ adj[u][v] = adj[v][u] = 1; return 1; }
	else{ return 0; }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...