Submission #503945

#TimeUsernameProblemLanguageResultExecution timeMemory
503945TranGiaHuy1508Combo (IOI18_combo)C++17
30 / 100
43 ms452 KiB
#include <bits/stdc++.h> using namespace std; int press(string p); #ifdef LOCAL int press(string p){ cout << p << "\n"; fflush(stdout); int r; cin >> r; return r; } #endif string ch = "ABXY"; string guess_sequence(int n){ string prefix = ""; string other; if (press("AABB")){ if (press("AA")){ prefix = "A"; other = "BXY"; } else{ prefix = "B"; other = "AXY"; } } else{ if (press("XX")){ prefix = "X"; other = "ABY"; } else{ prefix = "Y"; other = "ABX"; } } for (int i=2; i<=n; i++){ string c = prefix + other[0] + prefix + other[1]; if (press(c) > (int)prefix.length()){ string d = prefix + other[0]; if (press(d) > (int)prefix.length()){ prefix += other[0]; } else{ prefix += other[1]; } } else{ prefix += other[2]; } } return prefix; } #ifdef LOCAL int main(){ int n; cin >> n; cout << guess_sequence(n); } #endif
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...