Submission #772287

#TimeUsernameProblemLanguageResultExecution timeMemory
772287teokakabadzeCombo (IOI18_combo)C++17
100 / 100
24 ms672 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; int i; string s, p; char m[4]; std::string guess_sequence(int N) { int c = press("AB"); if(c) { if(press("AY")) s += 'A', m[0] = 'B', m[1] = 'X', m[2] = 'Y'; else s += 'B', m[0] = 'A', m[1] = 'X', m[2] = 'Y'; } else { if(press("AY")) s += 'Y', m[0] = 'A', m[1] = 'B', m[2] = 'X'; else s += 'X', m[0] = 'A', m[1] = 'B', m[2] = 'Y'; } for(i = 1; i < N - 1; i++) { p = s + m[0] + m[0] + s + m[0] + m[1] + s + m[0] + m[2] + s + m[1]; c = press(p); if(c == i + 2) s += m[0]; else if(c == i + 1) s += m[1]; else s += m[2]; } if(N > 1) { p = s + m[0]; if(press(p) == N) s += m[0]; else { p = s + m[1]; if(press(p) == N) s += m[1]; else s += m[2]; } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...