Submission #705615

#TimeUsernameProblemLanguageResultExecution timeMemory
705615garyyeCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { vector<char> c = {'A', 'B', 'X', 'Y'}; string f = ""; if(press("XY") > 0) { f = press("X") > 0 ? "X" : "Y"; } else { f = press("A") > 0 ? "A" : "B"; } c.erase(find(c.begin(), c.end(), f[0])); // A. -> 1 // BA. -> 2 // BB. -> 2 // BC. -> 2 // B. -> 1 // CA -> 2 // CB -> 2 for(int i = 1; i < N - 1; ++i) { string s = ""; s += f + c[0]; s += f + c[1] + c[0]; s += f + c[1] + c[1]; s += f + c[1] + c[2]; int g = guess_sequence(s); if(g == 0) f += c[2]; if(g == 1) f += c[0]; if(g == 2) f += c[1]; } // 2 + (N - 2) calls done if(guess_sequence(f + c[0]) == N) return f + c[0]; if(guess_sequence(f + c[1]) == N) return f + c[1]; return f + c[2]; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:33:32: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int'
   33 |         int g = guess_sequence(s);
      |                                ^
      |                                |
      |                                std::string {aka std::__cxx11::basic_string<char>}
combo.cpp:6:32: note:   initializing argument 1 of 'std::string guess_sequence(int)'
    6 | std::string guess_sequence(int N) {
      |                            ~~~~^
combo.cpp:40:25: error: cannot convert 'std::__cxx11::basic_string<char>' to 'int'
   40 |     if(guess_sequence(f + c[0]) == N)  return f + c[0];
combo.cpp:6:32: note:   initializing argument 1 of 'std::string guess_sequence(int)'
    6 | std::string guess_sequence(int N) {
      |                            ~~~~^
combo.cpp:41:25: error: cannot convert 'std::__cxx11::basic_string<char>' to 'int'
   41 |     if(guess_sequence(f + c[1]) == N)  return f + c[1];
combo.cpp:6:32: note:   initializing argument 1 of 'std::string guess_sequence(int)'
    6 | std::string guess_sequence(int N) {
      |                            ~~~~^