Submission #146585

#TimeUsernameProblemLanguageResultExecution timeMemory
146585karmaCombo (IOI18_combo)C++11
100 / 100
67 ms568 KiB
#include<bits/stdc++.h> #include "combo.h" #define pb push_back using namespace std; string guess_sequence(int n) { string res = ""; char c[] = {'A', 'B', 'X', 'Y'}; if(press("AB")) { if(press("A")) res.pb('A'); else res.pb('B'), swap(c[0], c[1]); } else { if(press("X")) res.pb('X'), swap(c[0], c[2]); else res.pb('Y'), swap(c[0], c[3]); } for(int i = 2; i < n; ++i) { int len = press(res + c[1] + c[1] + res + c[1] + c[2] + res + c[1] + c[3] + res + c[2]); if(len == i + 1) res.pb(c[1]); else if(len == i) res.pb(c[2]); else res.pb(c[3]); } if(n - 1) { if(press(res + c[1]) == n) res.pb(c[1]); else if(press(res + c[2]) == n) res.pb(c[2]); else res.pb(c[3]); } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...