Submission #233790

#TimeUsernameProblemLanguageResultExecution timeMemory
233790Toirov_SadiCombo (IOI18_combo)C++17
97 / 100
42 ms628 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N){ string res = "A"; 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'}; if(N == 1) return res; 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)res.size(); if(x == sz + 1) res += a[0]; else if(x == sz + 2) res += a[1]; else res += a[2]; } 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...