Submission #380627

#TimeUsernameProblemLanguageResultExecution timeMemory
380627sumit_kk10Game (IOI14_game)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
const int N = 1505;
int cnt[N], ct[N];

void initialize(int n){
	for(int i = 0; i <= n; ++i){
		cnt[i] = 0;
		ct[i] = 0;
	}
}

int hasEdge(int u, int v){
	cnt[u]++;
	cnt[v]++;
	if(cnt[u] == (n - ct[u] - 1)){
		cnt[u] = 0;
		cnt[v] = 0;
		ct[u]++, ct[v]++;
		return 1;
	}
	if(cnt[v] == (n - ct[v] - 1)){
		cnt[v] = 0;
		cnt[u] = 0;
		ct[u]++, ct[v]++;
		return 1;
	}
	return 0;
}

Compilation message (stderr)

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:16:16: error: 'n' was not declared in this scope
   16 |  if(cnt[u] == (n - ct[u] - 1)){
      |                ^
game.cpp:22:16: error: 'n' was not declared in this scope
   22 |  if(cnt[v] == (n - ct[v] - 1)){
      |                ^