Submission #647959

#TimeUsernameProblemLanguageResultExecution timeMemory
647959JANCARAPANCombo (IOI18_combo)C++17
97 / 100
74 ms552 KiB
#include "combo.h" //#include <bits/stdc++.h> using namespace std; string ch = "ABXY"; string guess_sequence(int n) { string s = ""; string a = ""; int block = -1; if (press("A") == 1) block = 0; else if (press("B") == 1) block = 1; else if (press("X") == 1) block = 2; else block = 3; s += ch[block]; for (int i=0; i<4; i++) { if (block == i) continue; a += ch[i]; } if (n == 1) return s; for (int i=1; i<n-1; i++) { int len = press(s+a[0]+s+a[1]+a[1]+s+a[1]+a[0]+s+a[1]+a[2]); if (len == i + 1) s += a[0]; else if (len == i + 2) s += a[1]; else s += a[2]; } if (press(s+a[0]) == n) return s+a[0]; else if (press(s+a[1]) == n) return s+a[1]; else return s+a[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...