Submission #163487

#TimeUsernameProblemLanguageResultExecution timeMemory
163487giorgikobGame (IOI14_game)C++14
Compilation error
0 ms0 KiB
#include "game.h"

const int N = 1e5+69;

int A[N];

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

int hasEdge(int u, int v) {
    
    if(A[u]>2 && A[v]>2)return 0;
    
    
    A[u]--,A[v]--;
    
    if(A[u]==0 || A[v]==0)return 1;
    
    if(A[u]==1){
    	if(k==2){
    		return 1;
		} else {
			k++;
		}
	}
	
	if(A[v]==1){
    	if(k==2){
    		return 1;
		} else {
			k++;
		}
	}
	
	return 0;
    
}

Compilation message (stderr)

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:24:9: error: 'k' was not declared in this scope
      if(k==2){
         ^
game.cpp:32:9: error: 'k' was not declared in this scope
      if(k==2){
         ^