Submission #235717

#TimeUsernameProblemLanguageResultExecution timeMemory
235717HeheheCombo (IOI18_combo)C++14
100 / 100
41 ms600 KiB
#include "combo.h" std::string guess_sequence(int N) { std::string t = ""; char first, a[5]; //first letter int p = press("AB"), k = 0, sz = 0; if(p == 2){ t += "AB"; first = 'A'; sz = 2; }else if(p == 1){ int x = press("A"); if(x)t += "A";else t += "B"; sz = 1; first = t[0]; }else{ int x = press("X"); if(x)t += "X";else t += "Y"; sz = 1; first = t[0]; } if (first != 'A') a[k++] = 'A'; if (first != 'B') a[k++] = 'B'; if (first != 'X') a[k++] = 'X'; if (first != 'Y') a[k++] = 'Y'; //middle while (sz <= N - 2){ std::string temp = t + a[0] + a[0]; temp += t + a[0] + a[1]; temp += t + a[0] + a[2]; temp += t + a[1]; p = press(temp); if (p - sz == 0) t += a[2]; else if (p - sz == 1) t += a[1]; else t += a[0]; sz++; } //end //check end if (sz == N - 1){ p = press(t + "A" + t + "B"); if (p == N){ p = press(t + "A"); if (p == N) t += "A"; else t += "B"; }else{ p = press(t + "X"); if (p == N) t += "X"; else t += "Y"; } } return t; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...