Submission #961168

#TimeUsernameProblemLanguageResultExecution timeMemory
961168raspyCombo (IOI18_combo)C++14
5 / 100
1 ms500 KiB
#include "combo.h" #include <iostream> using namespace std; string guess_sequence(int n) { char a[5] = {'A', 'B', 'X', 'Y'}; string p = "A"; string s = ""; { p = "AB"; int odg = press(p); if (odg) { p = "A"; if (press(p)) { s = "A"; swap(a[0], a[3]); } else { s = "B"; swap(a[1], a[3]); } } else { p = "X"; if (press(p)) { s = "X"; swap(a[2], a[3]); } else s = "Y"; } } for (int tr = 2; tr < n; tr++) { p = ""; p = s + a[0]; p = p + s+a[1]+a[0]; p = p + s+a[1]+a[2]; if (tr < n) p = p + s+a[1]+a[1]; // cout << p << " " << p.size() << "\n"; int odg = press(p); if (odg == tr) s += a[0]; else if (odg == tr+1) s += a[1]; else if (odg == tr-1) s += a[2]; } p = ""; { p = s+a[0]; int odg = press(p); if (odg == n) return p; p = s+a[1]; odg = press(p); if (odg == n) return p; p = s+a[2]; return p; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...