Submission #87130

#TimeUsernameProblemLanguageResultExecution timeMemory
87130solimm4sksCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
std::string guess_sequence(int N) { using namespace std; int n = N; string str = ""; char first; { int x, y; x = press("AB"); y = press("BX"); if(x == 0 && y == 0){ first = 'Y'; } if(x == 1 && y == 0){ first = 'A'; } if(x == 0 && y == 1){ first = 'X'; } if(x == 1 && y == 1){ first = 'B'; } } str += first; if(first == 'Y'){ for(int i = 0; i < n - 1; ++i){ int delta = str.size(); int x = press(str + "A" + str + "BA" + str + "BB" + str + "BX"); if(x - delta == 0){ str += "X"; } if(x - delta == 1){ str += "A"; } if(x - delta == 2){ str += "B"; } } } if(first == 'A'){ for(int i = 0; i < n - 1; ++i){ int delta = str.size(); int x = press(str + "Y" + str + "BY" + str + "BB" + str + "BX"); if(x - delta == 0){ str += "X"; } if(x - delta == 1){ str += "Y"; } if(x - delta == 2){ str += "B"; } } } if(first == 'X'){ for(int i = 0; i < n - 1; ++i){ int delta = str.size(); int x = press(str + "A" + str + "BA" + str + "BB" + str + "BY"); if(x - delta == 0){ str += "Y"; } if(x - delta == 1){ str += "A"; } if(x - delta == 2){ str += "B"; } } } if(first == 'B'){ for(int i = 0; i < n - 1; ++i){ int delta = str.size(); int x = press(str + "A" + str + "XA" + str + "XX" + str + "XY"); if(x - delta == 0){ str += "Y"; } if(x - delta == 1){ str += "A"; } if(x - delta == 2){ str += "X"; } } } return str; }

Compilation message (stderr)

combo.cpp:1:6: error: 'string' in namespace 'std' does not name a type
    1 | std::string guess_sequence(int N)
      |      ^~~~~~
combo.cpp:1:1: note: 'std::string' is defined in header '<string>'; did you forget to '#include <string>'?
  +++ |+#include <string>
    1 | std::string guess_sequence(int N)