Submission #417932

#TimeUsernameProblemLanguageResultExecution timeMemory
417932T0p_Combo (IOI18_combo)C++14
100 / 100
41 ms560 KiB
#include<bits/stdc++.h> #include "combo.h" // #include "grader.cpp" using namespace std; char c[4] = {'A', 'B', 'X', 'Y'}; string guess_sequence(int n) { string s = ""; int ret = press("AB"); if(ret == 0) { if(press("X")) { s += "X"; swap(c[0], c[2]); } else{ s += "Y"; swap(c[0], c[3]); } } else{ if(press("A")) { s += "A"; } else{ s += "B"; swap(c[0], c[1]); } } if(n == 1) return s; for(int i=1 ; i<n-1 ; i++) { string temp = ""; temp += s; temp += c[1]; temp += c[1]; temp += s; temp += c[1]; temp += c[2]; temp += s; temp += c[1]; temp += c[3]; temp += s; temp += c[2]; int ret = press(temp); if(ret == i) s += c[3]; else if(ret == i + 1) s += c[2]; else s += c[1]; } // cout << n << ' ' << s.size() << endl; if(press(s + c[1]) == n) s += c[1]; else if(press(s + c[2]) == n) s += c[2]; else s += c[3]; return s; } //ABBXXYYXYYXBBXY
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...