제출 #84834

#제출 시각아이디문제언어결과실행 시간메모리
84834SirCeness콤보 (IOI18_combo)C++14
97 / 100
57 ms636 KiB
#include "combo.h" #include <iostream> std::string guess_sequence(int N) { std::string head = ""; std::string str = ""; str = "AB"; char lead; if (press(str)){ str = "A"; if (press(str)){ head = "A"; lead = 'A'; } else{ head = "B"; lead = 'B'; } } else { str = "X"; if (press(str)){ head = "X"; lead = 'X'; } else { head = "Y"; lead = 'Y'; } } std::string a, b, c; if (lead == 'A'){ a = "B"; b = "X"; c = "Y"; } else if (lead == 'B'){ a = "A"; b = "X"; c = "Y"; } else if (lead == 'X'){ a = "B"; b = "A"; c = "Y"; } else if (lead == 'Y'){ a = "B"; b = "X"; c = "A"; } else std::cout << "FATAL_ERROR1_"; for (int i = 1; i < N-1; i++){ /*str = ""; str += head; str += a; str += a; str += head; str += a; str += b; str += head; str += a; str += c; str += head; str += b;*/ str = head + a + a + head + a + b + head + a + c + head + b; int coins = press(str); if (coins == i+2) head += a; else if (coins == i+1) head += b; else if (coins == i) head += c; else std::cout << "FATAL_ERROR2_"; } /*str = ""; str += head; str += a; str += head; str += b;*/ if (N == 1) return head; str = head + a + head + b; int coin = press(str); if (coin == N-1){ head += c; } else if (coin == N){ str = head + a; if (press(str) == N-1) head += b; else if (press(str) == N) head += a; else std::cout << "FATAL_ERROR4_"; } else std::cout << "FATAL_ERROR3_"; return head; } /* string p = ""; for (int i = 0; i < 4 * N; ++i) { p += 'A'; } int coins = press(p); string S = ""; for (int i = 0; i < N; ++i) { S += 'A'; } return S; */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...