Submission #873957

#TimeUsernameProblemLanguageResultExecution timeMemory
873957kh0iCombo (IOI18_combo)C++17
0 / 100
0 ms344 KiB
#include "combo.h" #include "bits/stdc++.h" using namespace std; #define sz(x) (int)(x).size() string guess_sequence(int N) { string p = ""; string S = ""; int a = press("A"); int b = press("B"); int x = press("X"); if(a) S = "A"; if(b) S = "B"; if(x) S = "X"; else S = "Y"; vector<string> choice; if(a) choice = {"B", "XX", "XB", "XY", "Y"}; if(b) choice = {"A", "XX", "XA", "XY", "Y"}; if(x) choice = {"A", "BB", "BA", "BY", "Y"}; else choice = {"A", "BB", "BA", "BX", "X"}; for(int i = 1; i < N; ++i){ string to_press = ""; for(int j = 0; j < 4; ++j) to_press += S + choice[j]; int len = press(to_press); if(len == sz(S)) S = S + choice.back(); else if(len == sz(S) + 1) S.push_back(choice.front().front()); else S.push_back(choice[1].front()); } return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...