제출 #300163

#제출 시각아이디문제언어결과실행 시간메모리
300163MickyOr콤보 (IOI18_combo)C++17
5 / 100
1 ms456 KiB
#include "combo.h" #include <bits/stdc++.h> #define fore(i, b, e) for (int i = b; i < (int)e; ++i) using namespace std; std::string guess_sequence(int N) { string pref; int val = press("AB"); if (val == 0) { val = press("X"); if (val == 0) pref = "Y"; else pref = "X"; } else { val = press("A"); if (val == 0) pref = "B"; else pref = "A"; } string extra = "ABXY"; while (extra[0] != pref[0]) next_permutation(extra.begin(), extra.end()); assert(extra[0] == pref[0]); fore(i, 1, N) { string test = pref + extra.substr(1,1); fore(i, 1, 4) { test += pref; test += extra.substr(2,1); test += extra[i]; } if ((int)test.size() > 4*N) break; //cerr << "test: " << test << endl; val = press(test); if (val == i) pref += extra[3]; if (val == i+1) pref += extra[1]; if (val == i+2) pref += extra[2]; } assert((int)pref.size() == N-1); val = press(pref + extra.substr(1,1) + pref + extra.substr(2,1)); if (val == N) { val = press(pref + extra.substr(1,1)); if (val == N) pref += extra[1]; else pref += extra[2]; } else { pref += extra[3]; } //cerr << "res = " << pref << endl; return pref; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...