Submission #383235

#TimeUsernameProblemLanguageResultExecution timeMemory
383235danielcm585Combo (IOI18_combo)C++14
100 / 100
49 ms560 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string s = "ABXY"; char c[3]; string guess_sequence(int N) { string ans; if (press("AB")) { if (press("A")) ans += 'A'; else ans += 'B'; } else { if (press("X")) ans += 'X'; else ans += 'Y'; } for (int i = 0, j = 0; i < 3; i++) { if (s[j] == ans[0]) j++; c[i] = s[j++]; } for (int i = 2; i <= N-1; i++) { int x = press(ans+c[0]+c[0]+ans+c[0]+c[1]+ans+c[0]+c[2]+ans+c[1]); if (x == i-1) ans += c[2]; else if (x == i) ans += c[1]; else ans += c[0]; } if (N > 1) { if (press(ans+c[0]) == N) ans += c[0]; else if (press(ans+c[1]) == N) ans += c[1]; else ans += c[2]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...