Submission #349247

# Submission time Handle Problem Language Result Execution time Memory
349247 2021-01-17T09:00:53 Z David_M Game (IOI14_game) C++14
Compilation error
0 ms 0 KB
int a[1505];
queue <int> q[1505];
void initialize(int n){
	for (int i=2; i<=n; i++)a[i]=1;
}
int hasEdge(int u, int v){
	int e=0;
	if(a[u])swap(v, u);
	if(!a[u]){
		a[v]--;
		if(!a[v]){
			e=1;
			while(!q[v].empty()){
				if(a[q[v].front()])a[q[v].front()]--;
				q[v].pop();
			}
		}
	}else q[v].push(u),q[u].push(v);
	
	return e;
}

Compilation message

game.cpp:2:1: error: 'queue' does not name a type
    2 | queue <int> q[1505];
      | ^~~~~
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:8:10: error: 'swap' was not declared in this scope
    8 |  if(a[u])swap(v, u);
      |          ^~~~
game.cpp:13:11: error: 'q' was not declared in this scope
   13 |    while(!q[v].empty()){
      |           ^
game.cpp:18:8: error: 'q' was not declared in this scope
   18 |  }else q[v].push(u),q[u].push(v);
      |        ^