Submission #421427

#TimeUsernameProblemLanguageResultExecution timeMemory
421427amoo_safarCombo (IOI18_combo)C++17
97 / 100
43 ms704 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; typedef string str; str guess_sequence(int n){ // std::string p = ""; // for (int i = 0; i < 4 * N; ++i) { // p += 'A'; // } // int coins = press(p); // std::string S = ""; // for (int i = 0; i < N; ++i) { // S += 'A'; // } // return S; str al = "ABXY"; for(int i = 1; i < 4; i++){ if( press( al.substr(i, 1) ) ){ swap(al[i], al[0]); break; } } str ans = ""; ans += al[0]; if(n == 1) return ans; for(int i = 1; i < n - 1; i++){ str q = ""; q += ans + al[1]; q += ans + al[2] + al[1]; q += ans + al[2] + al[2]; q += ans + al[2] + al[3]; int res = press(q); if(res == i) ans += al[3]; if(res == i + 1) ans += al[1]; if(res == i + 2) ans += al[2]; } for(int i = 2; i < 4; i++){ if( press( ans + al[i] ) == n ){ return ans + al[i]; } } return ans + al[1]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...