Submission #203878

#TimeUsernameProblemLanguageResultExecution timeMemory
203878staniewzkiCombo (IOI18_combo)C++17
100 / 100
116 ms780 KiB
#include<bits/stdc++.h> using namespace std; #include "combo.h" string let = "ABXY"; string conv(basic_string<int> a) { string str; for(int x : a) str += let[x]; return str; } int query(basic_string<int> a) { return press(conv(a)); } string guess_sequence(int n) { int f = -1; if(query({0, 1})) f = (query({0}) ? 0 : 1); else f = (query({2}) ? 2 : 3); swap(let[f], let[3]); basic_string<int> cur = {3}; for(int i = 1; i <= n - 2; i++) { auto g = cur + 2 + 0 + cur + 2 + 1 + cur + 2 + 2 + cur + 1; cur += query(g) - i; } if(n > 1) { if(query(cur + 0) == n) cur += 0; else if(query(cur + 1) == n) cur += 1; else cur += 2; } return conv(cur); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...