제출 #216497

#제출 시각아이디문제언어결과실행 시간메모리
216497T0p_콤보 (IOI18_combo)C++14
100 / 100
41 ms652 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...