Submission #349248

# Submission time Handle Problem Language Result Execution time Memory
349248 2021-01-17T09:02:05 Z David_M Game (IOI14_game) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
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:3:1: error: 'queue' does not name a type; did you mean 'sigqueue'?
    3 | queue <int> q[1505];
      | ^~~~~
      | sigqueue
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:9:10: error: 'swap' was not declared in this scope
    9 |  if(a[u])swap(v, u);
      |          ^~~~
game.cpp:9:10: note: suggested alternatives:
In file included from /usr/include/c++/9/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110,
                 from game.cpp:1:
/usr/include/c++/9/bits/regex.h:2029:5: note:   'std::__cxx11::swap'
 2029 |     swap(match_results<_Bi_iter, _Alloc>& __lhs,
      |     ^~~~
In file included from /usr/include/c++/9/exception:143,
                 from /usr/include/c++/9/ios:39,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from game.cpp:1:
/usr/include/c++/9/bits/exception_ptr.h:166:5: note:   'std::__exception_ptr::swap'
  166 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |     ^~~~
In file included from /usr/include/c++/9/bits/nested_exception.h:40,
                 from /usr/include/c++/9/exception:144,
                 from /usr/include/c++/9/ios:39,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from game.cpp:1:
/usr/include/c++/9/bits/move.h:182:5: note:   'std::swap'
  182 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
game.cpp:14:11: error: 'q' was not declared in this scope
   14 |    while(!q[v].empty()){
      |           ^
game.cpp:19:8: error: 'q' was not declared in this scope
   19 |  }else q[v].push(u),q[u].push(v);
      |        ^