Submission #1007013

#TimeUsernameProblemLanguageResultExecution timeMemory
1007013KindaNamelessCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h" using namespace std; string guess_sequence(int N){ string answer = ""; if(press("AB")){ if(press("A")){ answer += "A"; } else{ answer += "B"; } } else{ if(press("X")){ answer += "X"; } else{ answer += "Y"; } } vector<char> cand; if(answer[0] != 'A')cand.push_back('A'); if(answer[0] != 'B')cand.push_back('B'); if(answer[0] != 'X')cand.push_back('X'); if(answer[0] != 'Y')cand.push_back('Y'); string g; for(int i = 1; i <= N - 2; ++i){ g = answer + cand[0] + cand[0] + answer + cand[0] + cand[1] + answer + cand[0] + cand[2] + answer + cand[1]; int val = press(g); if(val == (int)answer.size() + 2){ answer += cand[0]; } else if(val == (int)answer.size() + 1){ answer += cand[1]; } else{ answer += cand[2]; } } g = answer + cand[0] + answer + cand[1]; if(press(g) == N){ g = answer + cand[0]; if(press(g) == N){ answer += cand[0]; } else{ answer += cand[1]; } } else{ answer += cand[2]; } return answer; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:23:5: error: 'vector' was not declared in this scope
   23 |     vector<char> cand;
      |     ^~~~~~
combo.cpp:2:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    1 | #include "combo.h"
  +++ |+#include <vector>
    2 | using namespace std;
combo.cpp:23:12: error: expected primary-expression before 'char'
   23 |     vector<char> cand;
      |            ^~~~
combo.cpp:24:25: error: 'cand' was not declared in this scope; did you mean 'rand'?
   24 |     if(answer[0] != 'A')cand.push_back('A');
      |                         ^~~~
      |                         rand
combo.cpp:25:25: error: 'cand' was not declared in this scope; did you mean 'rand'?
   25 |     if(answer[0] != 'B')cand.push_back('B');
      |                         ^~~~
      |                         rand
combo.cpp:26:25: error: 'cand' was not declared in this scope; did you mean 'rand'?
   26 |     if(answer[0] != 'X')cand.push_back('X');
      |                         ^~~~
      |                         rand
combo.cpp:27:25: error: 'cand' was not declared in this scope; did you mean 'rand'?
   27 |     if(answer[0] != 'Y')cand.push_back('Y');
      |                         ^~~~
      |                         rand
combo.cpp:31:22: error: 'cand' was not declared in this scope; did you mean 'rand'?
   31 |         g = answer + cand[0] + cand[0] + answer + cand[0] + cand[1] + answer + cand[0] + cand[2] + answer + cand[1];
      |                      ^~~~
      |                      rand
combo.cpp:45:18: error: 'cand' was not declared in this scope; did you mean 'rand'?
   45 |     g = answer + cand[0] + answer + cand[1];
      |                  ^~~~
      |                  rand