Submission #226621

#TimeUsernameProblemLanguageResultExecution timeMemory
226621AaronNaiduCombo (IOI18_combo)C++14
100 / 100
40 ms648 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int n) { string toRet; if (n == 1) { if (press("A")) { return "A"; } if (press("B")) { return "B"; } if (press("X")) { return "X"; } return "Y"; } if (press("AB")) { if (press("A")) { toRet = "A"; for (int i = 1; i < n-1; i++) { int x = press(toRet + "B" + toRet + "XB" + toRet + "XY" + toRet + "XX"); if (x == i) { toRet = toRet + "Y"; } else if (x == i + 1) { toRet = toRet + "B"; } else { toRet = toRet + "X"; } } if (press(toRet + "B") == n) { return toRet + "B"; } if (press(toRet + "X") == n) { return toRet + "X"; } return toRet + "Y"; } else { toRet = "B"; for (int i = 1; i < n-1; i++) { int x = press(toRet + "A" + toRet + "XA" + toRet + "XY" + toRet + "XX"); if (x == i) { toRet = toRet + "Y"; } else if (x == i + 1) { toRet = toRet + "A"; } else { toRet = toRet + "X"; } } if (press(toRet + "A") == n) { return toRet + "A"; } if (press(toRet + "X") == n) { return toRet + "X"; } return toRet + "Y"; } } else { if (press("X")) { toRet = "X"; for (int i = 1; i < n-1; i++) { int x = press(toRet + "B" + toRet + "AB" + toRet + "AY" + toRet + "AA"); if (x == i) { toRet = toRet + "Y"; } else if (x == i + 1) { toRet = toRet + "B"; } else { toRet = toRet + "A"; } } if (press(toRet + "B") == n) { return toRet + "B"; } if (press(toRet + "A") == n) { return toRet + "A"; } return toRet + "Y"; } else { toRet = "Y"; for (int i = 1; i < n-1; i++) { int x = press(toRet + "B" + toRet + "XB" + toRet + "XA" + toRet + "XX"); if (x == i) { toRet = toRet + "A"; } else if (x == i + 1) { toRet = toRet + "B"; } else { toRet = toRet + "X"; } } if (press(toRet + "B") == n) { return toRet + "B"; } if (press(toRet + "X") == n) { return toRet + "X"; } return toRet + "A"; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...