Submission #233782

#TimeUsernameProblemLanguageResultExecution timeMemory
233782Toirov_SadiCombo (IOI18_combo)C++17
0 / 100
1 ms200 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N){ string res = ""; vector<char> a = {'B', 'X', 'Y'}; if(press("B")) res += 'B', a = {'A', 'X', 'Y'}; if(press("X")) res += 'X', a = {'A', 'B', 'Y'}; if(press("Y")) res += 'Y', a = {'A', 'B', 'X'}; for(int i = 1; i < N - 1; i ++){ string t; t += (res + a[0]); t += (res + a[1] + a[0]); t += (res + a[1] + a[1]); t += (res + a[1] + a[2]); int x = press(t); int sz = (int)t.size(); if(x == sz + 1) res += a[0]; else if(x == sz + 2) res += a[1]; else res += a[2]; } if(N > 1){ string t; t += res + a[0]; t += res + a[1]; if(press(t) == N){ t = res + a[0]; if(press(t) == N) res += a[0]; else res += a[1]; } else{ res += a[2]; } } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...