Submission #137979

#TimeUsernameProblemLanguageResultExecution timeMemory
137979MoNsTeR_CuBeCombo (IOI18_combo)C++17
5 / 100
3 ms264 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; vector< char > guess{'A', 'B', 'X', 'Y'}; void recur(string &pref, int index){ if(index == 0) return; string s = ""; s = pref + guess[0] + pref + guess[1] + guess[0] + pref + guess[1] + guess[1] + pref + guess[1] + guess[2]; int rep = press(s); if(rep == (int)pref.size()){ pref += guess[2]; recur(pref, index - 1); }else if(rep == (int)pref.size()+1){ pref = (pref + guess[0]); recur(pref, index - 1); }else{ pref = (pref + guess[1]); recur(pref, index - 1); } } string guess_sequence(int N) { string s = "AB"; if(press(s)){ s = "A"; if(!press(s)){ s = "B"; } }else{ s = "X"; if(!press(s)){ s = "Y"; } } for(int i = 0; i < 4; i++){ if(s[0] == guess[i]){ swap(guess[i], guess.back()); guess.pop_back(); break; } } recur(s, N-2); s += guess[0]; if(press(s) == N){ return s; } s.back() = guess[1]; if(press(s) == N) return s; s.back() = guess[2]; return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...