Submission #652589

#TimeUsernameProblemLanguageResultExecution timeMemory
652589Markomafko972Game (IOI14_game)C++14
Compilation error
0 ms0 KiB
#include "game.h"
#include <bits/stdc++.h>
#define X first
#define Y second
#define pb push_back
#define pii pair<int, int>
typedef long long ll;
using namespace std;

const int MOD = 1e9 + 7;
const ll INF = 1e18;
const int OFF = (1 << 20);

int prt[1505];
int kol[1505][1505];

void initialize(int n) {
	for (int i = 0; i < n; i++) {
		prt[i] = i;
		for (int j = 0; j < n; j++) {
			if (i == j) continue;
			kol[i][j] = 1;
		}
	}
}

int find(int x) {
	if (x == prt[x]) return x;
	return prt[x] = find(prt[x]);
}

int hasEdge(int x, int y) {
	x = find(x);
	y = find(y);
	
	if (kol[x][y] > 1) {
		kol[x][y]--;
		kol[y][x]--;
		return 0;
	}
	
	for (int i = 0; i < n; i++) {
		kol[x][i] += kol[y][i];
	}
	
	x = prt[y];
	return 1;
}

Compilation message (stderr)

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:42:22: error: 'n' was not declared in this scope
   42 |  for (int i = 0; i < n; i++) {
      |                      ^