Submission #802452

#TimeUsernameProblemLanguageResultExecution timeMemory
802452Gabi88Combo (IOI18_combo)C++14
97 / 100
28 ms540 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; /* int press(string a){ int x; cout << a << endl; cin >> x; return x; }*/ string guess_sequence(int n){ string s; vector<char> v; int t = press("AB"); int pos = 2; if (t > 0){ t = press("A"); if (t == 1){ s = "A"; v.push_back('B'); v.push_back('X'); v.push_back('Y');} else{ s = "B"; v.push_back('A'); v.push_back('X'); v.push_back('Y'); } }else{ t = press("X"); if (t == 1){ s = "X"; v.push_back('A'); v.push_back('B'); v.push_back('Y'); } else{ s = "Y"; v.push_back('A'); v.push_back('B'); v.push_back('X'); } } while(pos < n){ t = press(s+v[0]+s+v[1]+v[0]+s+v[1]+v[1]+s+v[1]+v[2]); if (t == pos-1) s += v[2]; else if (t == pos) s += v[0]; else s += v[1]; pos++; } for(int i=0; i<2; i++){ t = press(s+v[i]); if (t == pos){ pos++; s += v[i]; } } if (pos == n) s += v[2]; return s; }/* int main(){ int n; cin >> n; cout << "-> " << guess_sequence(n) << endl; }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...