Submission #1177491

#TimeUsernameProblemLanguageResultExecution timeMemory
1177491tegshzayaCave (IOI13_cave)C++20
Compilation error
0 ms0 KiB
#include "cave.h"
#include<bits/stdc++.h>
#define ll int
#define ss second
#define ff first
#define pb push_back
void exploreCave(int N){
   	ll a[N+5],b[N+5],c[N+5];
	for(ll i=0;i<N;i++){
    	ll s[N+5];
    	for(ll j=0;j<N;j++){
    		if(c[j]!=0) s[j]=a[j];
			else s[j]=0;
		}
		ll x=tryCombination(s);
		ll t=1;
		if(x==-1 || x>i) t=0;
		vector<ll> v;
		for(ll j=0;j<n;j++){
			if(c[j]==0) v.pb(j);
		}
		while(v.size()>1){
			for(ll j=0;j<n;j++){
				if(c[j]!=0) s[j]=a[j];
				else s[j]=0;
			}
	
			vector<ll> v1,v2;
			ll u=v.size();
			for(ll j=0;j<u/2;j++){
				v1.pb(v[j]);
				s[v[j]]=(1-t);
			}
			for(ll j=u/2;j<u;j++){
				v2.pb(v[j]);
				s[v[j]]=(1-t);
			}
			x=tryCombination(s);
			if(x==-1 || x>i) v=v1;
			else v=v2;
		}
		c[v.back()]=1;
		a[v.back()]=t;
		b[v.back()]=i;
	}
	ll s[N+5],k[N+5];
	for(ll i=0;i<N;i++){
		s[i]=a[i];
		k[i]=b[i];
	}
	answer(s,k);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:18:17: error: 'vector' was not declared in this scope
   18 |                 vector<ll> v;
      |                 ^~~~~~
cave.cpp:18:17: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from cave.cpp:2:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from cave.cpp:2:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
cave.cpp:3:12: error: expected primary-expression before 'int'
    3 | #define ll int
      |            ^~~
cave.cpp:18:24: note: in expansion of macro 'll'
   18 |                 vector<ll> v;
      |                        ^~
cave.cpp:19:30: error: 'n' was not declared in this scope
   19 |                 for(ll j=0;j<n;j++){
      |                              ^
cave.cpp:20:37: error: 'v' was not declared in this scope
   20 |                         if(c[j]==0) v.pb(j);
      |                                     ^
cave.cpp:22:23: error: 'v' was not declared in this scope
   22 |                 while(v.size()>1){
      |                       ^
cave.cpp:23:38: error: 'n' was not declared in this scope
   23 |                         for(ll j=0;j<n;j++){
      |                                      ^
cave.cpp:3:12: error: expected primary-expression before 'int'
    3 | #define ll int
      |            ^~~
cave.cpp:28:32: note: in expansion of macro 'll'
   28 |                         vector<ll> v1,v2;
      |                                ^~
cave.cpp:31:33: error: 'v1' was not declared in this scope; did you mean '__pstl::execution::v1'?
   31 |                                 v1.pb(v[j]);
      |                                 ^~
      |                                 __pstl::execution::v1
In file included from /usr/include/c++/11/pstl/glue_algorithm_defs.h:15,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from cave.cpp:2:
/usr/include/c++/11/pstl/execution_defs.h:19:18: note: '__pstl::execution::v1' declared here
   19 | inline namespace v1
      |                  ^~
cave.cpp:35:33: error: 'v2' was not declared in this scope
   35 |                                 v2.pb(v[j]);
      |                                 ^~
cave.cpp:39:44: error: 'v1' was not declared in this scope; did you mean '__pstl::execution::v1'?
   39 |                         if(x==-1 || x>i) v=v1;
      |                                            ^~
      |                                            __pstl::execution::v1
In file included from /usr/include/c++/11/pstl/glue_algorithm_defs.h:15,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from cave.cpp:2:
/usr/include/c++/11/pstl/execution_defs.h:19:18: note: '__pstl::execution::v1' declared here
   19 | inline namespace v1
      |                  ^~
cave.cpp:40:32: error: 'v2' was not declared in this scope
   40 |                         else v=v2;
      |                                ^~
cave.cpp:42:19: error: 'v' was not declared in this scope
   42 |                 c[v.back()]=1;
      |                   ^