Submission #962670

#TimeUsernameProblemLanguageResultExecution timeMemory
962670serkanrashidCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; const int maxn = 5005; int tekdoor; int rec(vector<int>pos) { if(pos.size()==1) return pos[0]; int mid = (pos.size()-1)/2; for(int j = 0; j <= mid; j++) s[pos[j]] ^= 1; int ch = tryCombination(s); vector<int>nb; if(ch == i) { for(int j = mid+1; j < pos.size(); j++) nb.push_back(pos[j]); return rec(nb); } for(int j = 0; j <= mid; j++) { s[pos[j]] ^= 1; nb.push_back(pos); } return rec(nb); } void exploreCave(int N) { int ch; int *s = new int[N]; int *d = new int[N]; for(int i = 0; i < N; i++) d[i] = -1; for(int i = 0; i < N; i++) { vector<int>pos; for(int j = 0; j < N; j++) { if(d[j] == -1) { s[j] = 0; pos.push_back(j); } } ch = tryCombination(s); if(ch != i) { for(int j = 0; j < N; j++) if(d[j] == -1) s[j] = 1; } int idx = rec(pos); d[idx] = i; s[idx] ^= 1; } for(int i = 0; i < N; i++) s[i] ^= 1; answer(s,d); }

Compilation message (stderr)

cave.cpp: In function 'int rec(std::vector<int>)':
cave.cpp:14:35: error: 's' was not declared in this scope
   14 |     for(int j = 0; j <= mid; j++) s[pos[j]] ^= 1;
      |                                   ^
cave.cpp:15:29: error: 's' was not declared in this scope
   15 |     int ch = tryCombination(s);
      |                             ^
cave.cpp:17:14: error: 'i' was not declared in this scope
   17 |     if(ch == i)
      |              ^
cave.cpp:19:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         for(int j = mid+1; j < pos.size(); j++) nb.push_back(pos[j]);
      |                            ~~^~~~~~~~~~~~
cave.cpp:25:25: error: no matching function for call to 'std::vector<int>::push_back(std::vector<int>&)'
   25 |         nb.push_back(pos);
      |                         ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from cave.cpp:2:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const value_type&' {aka 'const int&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~