Submission #199529

#TimeUsernameProblemLanguageResultExecution timeMemory
199529monus1042Combo (IOI18_combo)C++17
30 / 100
87 ms424 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string aux("ABXY"); string use=""; string S=""; int coins=0; bool done=false; for (int i=0; i<3; i++){ string gg; gg.push_back(aux[i]); coins=press(gg); if (coins){ done=true; S+=aux[i]; for(int j=0; j<4; j++) if (aux[j]!=aux[i]) use.push_back(aux[j]); break; } } if (!done){ S.push_back(aux[3]); for(int j=0; j<3; j++) use.push_back(aux[j]); coins=1; } while((int)S.size()!=N){ done=false; for (int i=0; i<2; i++){ S+=use[i]; int ne=press(S); if (ne==coins+1){ done=true; coins=ne; break; }else S.pop_back(); } if (!done){S.push_back(use[2]); coins++;} } return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...