제출 #141425

#제출 시각아이디문제언어결과실행 시간메모리
141425MathStudent2002콤보 (IOI18_combo)C++14
0 / 100
1 ms272 KiB
#include "combo.h" using namespace std; string guess_sequence(int N) { string p = "AB"; int coins = press(p); string cur = ""; char c[3]; if(coins == 0) { p = "X"; coins = press(p); if(coins == 0) {cur = "Y"; c[0] = 'A'; c[1] = 'B'; c[2] = 'X';} else {cur == "X"; c[0] = 'A'; c[1] = 'B'; c[2] = 'Y';} } else { p = "A"; coins = press(p); if(coins == 0) {cur = "B"; c[0] = 'A'; c[1] = 'X'; c[2] = 'Y';} else {cur = "A"; c[0] = 'B'; c[1] = 'X'; c[2] = 'Y';} } string S; for(int i = 1; i <= N-2; i++) { S = (cur + c[0]) + (cur + c[1] + c[0]) + (cur + c[1] + c[1]) + (cur + c[1] + c[2]); coins = press(S); if(coins == i) {cur += c[2];} else if(coins == (i+1)) {cur += c[0];} else {cur += c[1];} } S = (cur + c[0]) + (cur + c[1]); coins = press(S); if(coins < N) {return (cur + c[2]);} S = cur + c[0]; coins = press(S); if(coins < N) {return (cur + c[1]);} return (cur + c[0]); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...