제출 #75676

#제출 시각아이디문제언어결과실행 시간메모리
75676idLe콤보 (IOI18_combo)C++14
100 / 100
53 ms492 KiB
#include "combo.h" std::string guess_sequence(int N) { std::string t = ""; char first, tr[5]; //check first int p = press("AB"), sz = 0, k = 0; if (!p){ p = press("X"); if (p == 1) t += "X", first = 'X'; else t += "Y", first = 'Y'; sz++; } else if (p == 1){ p = press("A"); if (p == 1) t += "A", first = 'A'; else t += "B", first = 'B'; sz++; } else t += "AB", sz += 2, first = 'A'; if (first != 'A') tr[k++] = 'A'; if (first != 'B') tr[k++] = 'B'; if (first != 'X') tr[k++] = 'X'; if (first != 'Y') tr[k++] = 'Y'; //check middle while (sz <= N - 2){ std::string temp = t + tr[0] + tr[0]; temp += t + tr[0] + tr[1]; temp += t + tr[0] + tr[2]; temp += t + tr[1]; p = press(temp); if (p - sz == 0) t += tr[2]; else if (p - sz == 1) t += tr[1]; else t += tr[0]; sz++; } //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...