Submission #569458

#TimeUsernameProblemLanguageResultExecution timeMemory
569458penguin133Combo (IOI18_combo)C++14
100 / 100
34 ms620 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { string t1 = "AB"; vector<char>v; string ans; if(press(t1)){ t1 = "A"; if(press(t1))v = {'B', 'X', 'Y'}, ans = t1; else v = {'A', 'X', 'Y'} , ans = "B"; } else{ t1 = "X"; if(press(t1))v = {'A', 'B', 'Y'}, ans = "X"; else v = {'A', 'B', 'X'}, ans = "Y"; } for(int i=2;i<N;i++){ string t = ans; t += v[0]; t += v[0]; t += ans; t += v[0]; t += v[1]; t += ans; t += v[0]; t += v[2]; t += ans; t += v[1]; int x = press(t); if(x == i - 1)ans += v[2]; else if(x == i)ans += v[1]; else ans += v[0]; } if(N != 1){ string t1 = ans; t1 += "A"; t1 += ans; t1 += "B"; vector<char>v; if(press(t1) == N){ t1 = ans + "A"; if(press(t1) == N) ans = t1; else ans += "B"; } else{ t1 = ans + "X"; if(press(t1) == N)ans += "X"; else ans += "Y"; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...