Submission #637036

#TimeUsernameProblemLanguageResultExecution timeMemory
637036bonkCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "cave.h" void exploreCave(int n){ vector<int>s(n, -1), d(n); vector<bool>mark(n); for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++) if(!mark[j]) s[j] = 0; int x = tryCombination(s); if(x == i){ for(int j = 0; j < n; j++) if(!mark[j]) s[j] = 1; } int l = 0, r = n - 1; int a = 0; while(l <= r){ int mid = (l + r)/2; for(int j = 0; j < mid; j++) if(!mark[j]) s[j] ^= 1; int tmp = tryCombination(s); if(tmp == -1) tmp = n + 1; if(tmp > i){ a = mid; l = mid + 1; } else{ r = mid - 1; } for(int j = 0; j < mid; j++) if(!mark[j]) s[j] ^= 1; } mark[a] = true; d[a] = i; } answer(s, d); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:5:5: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
    5 |     vector<int>s(n, -1), d(n);
      |     ^~~~~~
      |     std::vector
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:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note: 'std::vector' declared here
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
cave.cpp:5:12: error: expected primary-expression before 'int'
    5 |     vector<int>s(n, -1), d(n);
      |            ^~~
cave.cpp:6:12: error: expected primary-expression before 'bool'
    6 |     vector<bool>mark(n);
      |            ^~~~
cave.cpp:8:40: error: 'mark' was not declared in this scope
    8 |         for(int j = 0; j < n; j++) if(!mark[j]) s[j] = 0;
      |                                        ^~~~
cave.cpp:8:49: error: 's' was not declared in this scope
    8 |         for(int j = 0; j < n; j++) if(!mark[j]) s[j] = 0;
      |                                                 ^
cave.cpp:9:32: error: 's' was not declared in this scope
    9 |         int x = tryCombination(s);
      |                                ^
cave.cpp:11:44: error: 'mark' was not declared in this scope
   11 |             for(int j = 0; j < n; j++) if(!mark[j]) s[j] = 1;
      |                                            ^~~~
cave.cpp:19:46: error: 'mark' was not declared in this scope
   19 |             for(int j = 0; j < mid; j++) if(!mark[j]) s[j] ^= 1;
      |                                              ^~~~
cave.cpp:28:46: error: 'mark' was not declared in this scope
   28 |             for(int j = 0; j < mid; j++) if(!mark[j]) s[j] ^= 1;
      |                                              ^~~~
cave.cpp:31:9: error: 'mark' was not declared in this scope
   31 |         mark[a] = true;
      |         ^~~~
cave.cpp:32:9: error: 'd' was not declared in this scope
   32 |         d[a] = i;
      |         ^
cave.cpp:35:12: error: 's' was not declared in this scope
   35 |     answer(s, d);
      |            ^
cave.cpp:35:15: error: 'd' was not declared in this scope
   35 |     answer(s, d);
      |               ^