Submission #1113560

#TimeUsernameProblemLanguageResultExecution timeMemory
1113560ZflopCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; vector<char>letter{'A','B','X','Y'}; std::string guess_sequence(int N) { string ans; vector<char>actual; for (int i = 0; i < 4;++i) if (press(letter[i])) { starting += letter[i]; } else actual.push_back(letter[i]); while(ans.size() < N - 1) { string g = ans + actual[0] + actual[0] + ans + actual[0] + actual[1] + ans + actual[0] + actual[2] + ans + actual[1]; int ret = press(g); if (ret == ans.size()) ans += actual[2]; else if (ret == ans.size() + 1) ans += actual[1]; else ans += actual[0]; } string g = ans + actual[0]; if (press(g) == N) return g; g = ans + actual[1]; if (press(g) == N) return g; return ans + actual[2]; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:11:6: error: 'press' was not declared in this scope
   11 |  if (press(letter[i])) {
      |      ^~~~~
combo.cpp:12:3: error: 'starting' was not declared in this scope; did you mean 'static'?
   12 |   starting += letter[i];
      |   ^~~~~~~~
      |   static
combo.cpp:10:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   10 |   for (int i = 0; i < 4;++i)
      |   ^~~
combo.cpp:16:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   16 |  while(ans.size() < N - 1) {
      |  ^~~~~
combo.cpp:16:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |  while(ans.size() < N - 1) {
      |        ~~~~~~~~~~~^~~~~~~
combo.cpp:18:13: error: 'press' was not declared in this scope
   18 |   int ret = press(g);
      |             ^~~~~
combo.cpp:19:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |   if (ret == ans.size())
      |       ~~~~^~~~~~~~~~~~~
combo.cpp:21:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |   else if (ret == ans.size() + 1)
      |            ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:27:6: error: 'press' was not declared in this scope
   27 |  if (press(g) == N) return g;
      |      ^~~~~
combo.cpp:29:6: error: 'press' was not declared in this scope
   29 |  if (press(g) == N) return g;
      |      ^~~~~