Submission #87137

#TimeUsernameProblemLanguageResultExecution timeMemory
87137solimm4sksCombo (IOI18_combo)C++14
0 / 100
1 ms216 KiB
#include <combo.h> 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((int)str.size() == n){ return str; } if(first == 'Y'){ for(int i = 0; i < n - 1; ++i){ int delta = str.size(); if(delta == n - 1){ break; } 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"; } } int delta = str.size(); int x = press(str + "A"); int y = press(str + "B"); if(x - delta == 0 && y - delta == 0){ str += "X"; } if(x - delta == 1){ str += "A"; } if(y - delta == 1){ str += "B"; } } if(first == 'A'){ for(int i = 0; i < n - 1; ++i){ int delta = str.size(); if(delta == n - 1){ break; } 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"; } } int delta = str.size(); int x = press(str + "X"); int y = press(str + "Y"); if(x - delta == 0 && y - delta == 0){ str += "B"; } if(x - delta == 1){ str += "X"; } if(y - delta == 1){ str += "Y"; } } if(first == 'X'){ for(int i = 0; i < n - 1; ++i){ int delta = str.size(); if(delta == n - 1){ break; } 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"; } } int delta = str.size(); int x = press(str + "A"); int y = press(str + "B"); if(x - delta == 0 && y - delta == 0){ str += "Y"; } if(x - delta == 1){ str += "A"; } if(y - delta == 1){ str += "B"; } } if(first == 'B'){ for(int i = 0; i < n - 1; ++i){ int delta = str.size(); if(delta == n - 1){ break; } 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"; } } int delta = str.size(); int x = press(str + "X"); int y = press(str + "Y"); if(x - delta == 0 && y - delta == 0){ str += "A"; } if(x - delta == 1){ str += "X"; } if(y - delta == 1){ str += "Y"; } } return str; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...