Submission #141426

#TimeUsernameProblemLanguageResultExecution timeMemory
141426MathStudent2002Combo (IOI18_combo)C++14
0 / 100
2 ms268 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';} } if(N == 1) return cur; 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...