Submission #518821

#TimeUsernameProblemLanguageResultExecution timeMemory
518821alexx_stefanCombo (IOI18_combo)C++17
100 / 100
35 ms616 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int n) { if (n == 1) { if (press("A") == 1) return "A"; if (press("B") == 1) return "B"; if (press("X") == 1) return "X"; return "Y"; } int r = press("AB"); vector <char> opt; string sir; if (r == 0) { r = press ("X"); opt.push_back('A'); opt.push_back('B'); if (r == 1) { sir+="X"; opt.push_back('Y'); } else { sir += "Y"; opt.push_back('X'); } } else { r = press ("A"); opt.push_back('X'); opt.push_back('Y'); if (r == 1) { sir+="A"; opt.push_back('B'); } else { sir += "B"; opt.push_back('A'); } } for (int pas = 2; pas < n; pas++) { string ask = sir + opt[0] + opt[0] + sir + opt[0] + opt[1] + sir + opt[0] + opt[2] + sir + opt[1]; r = press(ask); if (r == pas + 1) sir += opt[0]; else if (r == pas) sir += opt[1]; else sir += opt[2]; } string ask = sir + opt[0]; r = press(ask); if (r == n) sir += opt[0]; else { ask = sir + opt[1]; r = press(ask); if (r == n) sir += opt[1]; else sir += opt[2]; } return sir; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...