제출 #89694

#제출 시각아이디문제언어결과실행 시간메모리
89694Shafin666콤보 (IOI18_combo)C++14
5 / 100
3 ms256 KiB
#include <bits/stdc++.h> #include "combo.h" #define mp make_pair #define pb push_back #define pii pair<int, int> typedef long long ll; typedef long double ld; using namespace std; char f[4]; void scramble(string str) { for(int i = 0; i < 3; i++) f[i] = str[i]; } std::string guess_sequence(int N) { string str = "AB"; int k = press(str); if(k >= 1) { str = "A"; k = press(str); if(k == 1) f[3] = 'A', scramble("BXY"); else f[3] = 'B', scramble("AXY"); } else { str = "Y"; k = press(str); if(k == 1) f[3] = 'Y', scramble("ABX"); else f[3] = 'X', scramble("ABY"); } string S; S += f[3]; int len = 1; while(len < N-1) { string tmp = S+f[0]+f[1] + S+f[0]+f[2] + S+f[0]+f[0] + S+f[2]; k = press(tmp); if(k == len+1) S += f[2], len++; else if(k == len+2) S += f[0], len++; else S += f[1], len++; } string tmp = S + f[0] + S + f[1]; k = press(tmp); if(k == len+1) { tmp = S + f[0]; k = press(tmp); if(k == len+1) return S + f[0]; else return S + f[1]; } return S + f[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...