Submission #1204248

#TimeUsernameProblemLanguageResultExecution timeMemory
120424812baater콤보 (IOI18_combo)C++20
100 / 100
7 ms468 KiB
#include "combo.h" #include <vector> using namespace std; string guess_sequence(int N) { string buttons[4] = {"A","B","X","Y"}; vector<string> notFirst; string k = ""; int kLength = 1; string first = "A"; int coins = press("AB"); if (coins >= 1) { coins = press("A"); if (coins == 1) first = "A"; else first = "B"; } else { coins = press("Y"); if (coins == 1) first = "Y"; else first = "X"; } k += first; for(int i = 0; i < 4; i++) { if (buttons[i] == first) continue; notFirst.push_back(buttons[i]); } while(kLength+2 <= N) { coins = press(k+notFirst[0]+k+notFirst[1]+notFirst[0]+k+notFirst[1]+notFirst[1]+k+notFirst[1]+notFirst[2]); if(coins == kLength) { k += notFirst[2]; kLength++; } else if (coins == kLength+1) { k += notFirst[0]; kLength++; } else { k += notFirst[1]; kLength++; } } if (N>1) { coins = press(k+notFirst[0]+k+notFirst[1]); if (coins == kLength+1) { coins = press(k+notFirst[0]); if (coins == kLength+1) { k += notFirst[0]; } else { k += notFirst[1]; } } else { k += notFirst[2]; } } return k; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...