Submission #366062

#TimeUsernameProblemLanguageResultExecution timeMemory
366062KoDCave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include "cave.h" #include <set> int S[5000]; int D[5000]; void exploreCave(int N) { const auto query = [&] { const auto ret = tryCombination(S); return ret == -1 ? N : ret; }; std::set<int> remain; for (int i = 0; i < N; ++i) { remain.insert(i); } for (int d = 0; d < N; ++d) { // Which switch is connected to the door 'd' ? for (const auto x: remain) { S[x] = 0; } const auto allZero = query(); Vec<int> cur(remain.begin(), remain.end()); while (cur.size() > 1) { Vec<int> next; next.reserve((cur.size() + 1) / 2); while (cur.size() > next.size()) { next.push_back(cur.back()); cur.pop_back(); } for (const auto x: cur) { S[x] = 1; } const auto tmp = query(); for (const auto x: cur) { S[x] = 0; } if ((allZero == d) == (tmp == d)) { cur = std::move(next); } } const auto i = cur.front(); remain.erase(i); D[i] = d; S[i] = (allZero == d ? 1 : 0); } answer(S, D); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:22:5: error: 'Vec' was not declared in this scope
   22 |     Vec<int> cur(remain.begin(), remain.end());
      |     ^~~
cave.cpp:22:9: error: expected primary-expression before 'int'
   22 |     Vec<int> cur(remain.begin(), remain.end());
      |         ^~~
cave.cpp:23:12: error: 'cur' was not declared in this scope
   23 |     while (cur.size() > 1) {
      |            ^~~
cave.cpp:24:11: error: expected primary-expression before 'int'
   24 |       Vec<int> next;
      |           ^~~
cave.cpp:25:7: error: 'next' was not declared in this scope; did you mean 'std::next'?
   25 |       next.reserve((cur.size() + 1) / 2);
      |       ^~~~
      |       std::next
In file included from /usr/include/c++/9/bits/stl_algobase.h:66,
                 from /usr/include/c++/9/bits/stl_tree.h:63,
                 from /usr/include/c++/9/set:60,
                 from cave.cpp:2:
/usr/include/c++/9/bits/stl_iterator_base_funcs.h:213:5: note: 'std::next' declared here
  213 |     next(_InputIterator __x, typename
      |     ^~~~
cave.cpp:41:20: error: 'cur' was not declared in this scope
   41 |     const auto i = cur.front();
      |                    ^~~