Submission #774486

#TimeUsernameProblemLanguageResultExecution timeMemory
774486AlfraganusCombo (IOI18_combo)C++14
100 / 100
27 ms572 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n){ string s = "AB", t, d; if(press(s)){ s = "A"; t = press(s) ? "A" : "B"; } else{ s = "X"; t = press(s) ? "X" : "Y"; } if(n == 1)return t; for(auto &x : "ABXY")if(x != t[0])d.push_back(x); for(int i = 1; i < n - 1; i ++){ s = t; s += d[0]; s += t; s += d[1]; s += d[0]; s += t; s += d[1]; s += d[1]; s += t; s += d[1]; s += d[2]; int res = press(s); if(res <= i)t += d[2]; else if(res == i + 1)t += d[0]; else t += d[1]; } s = t; s += d[0]; if(press(s) == n)return s; s = t; s += d[1]; if(press(s) == n)return s; t += d[2]; return t; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...