Submission #1020118

#TimeUsernameProblemLanguageResultExecution timeMemory
1020118IssaCombo (IOI18_combo)C++17
0 / 100
1 ms344 KiB
#include <bits/stdc++.h> using namespace std; int press(std::string p); string guess_sequence(int N){ if(N == 1){ if(press("A")) return "A"; if(press("B")) return "B"; if(press("X")) return "X"; return "Y"; } vector<string> t = {"A", "B", "X", "Y"}; string s; if(press("AB")){ if(press("A")) s = "A"; else s = "B"; } else{ if(press("X")) s = "X"; else s = "Y"; } for(string &c: t){ if(c == s){ swap(c, t.back()); break; } } t.pop_back(); for(int i = 2; i < N; i++){ int x = press(s + t[0] + t[0] + s + t[0] + t[1] + s + t[0] + t[2] + s + t[1]); s += t[2 - (x - i + 1)]; } if(press(s + t[0]) == N) s += t[0]; else if(press(s + t[1])) s += t[1]; else s += t[2]; cout << s << endl; return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...