Submission #800067

#TimeUsernameProblemLanguageResultExecution timeMemory
800067JosiaCombo (IOI18_combo)C++17
5 / 100
1 ms280 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { char start = '?'; if (press("AB")) { if (press("A")) start='A'; else start='B'; } else { if (press("X")) start='X'; else start='Y'; } vector<char> trans; for (char i: {'A', 'B', 'X', 'Y'}) if (i != start) trans.push_back(i); string res = {start}; for (int i = 1; i<N-1; i++) { string p = ""; p.append(res); p.push_back(trans[0]); p.push_back(trans[0]); p.append(res); p.push_back(trans[0]); p.push_back(trans[1]); p.append(res); p.push_back(trans[0]); p.push_back(trans[2]); p.append(res); p.push_back(trans[1]); int coins = press(p); if (coins == (int)res.size()) { res.push_back(trans[2]); } if (coins == (int)res.size()+1) { res.push_back(trans[1]); } if (coins == (int)res.size()+2) { res.push_back(trans[0]); } } string p = ""; p.append(res); p.push_back(trans[0]); if (press(p) == N) { res.push_back(trans[0]); } else { p.pop_back(); p.push_back(trans[1]); if (press(p) == N) { res.push_back(trans[1]); } else res.push_back(trans[2]); } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...