제출 #133471

#제출 시각아이디문제언어결과실행 시간메모리
133471KieranHorgan콤보 (IOI18_combo)C++17
100 / 100
49 ms512 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { vector<char> v; string S; int x = press("AB"); if(x) { if(press("A")) { S="A"; v={'B','X','Y'}; } else { S="B"; v={'A','X','Y'}; } } else { if(press("X")) { S="X"; v = {'A','B','Y'}; } else { S="Y"; v = {'A','B','X'}; } } // cerr << S << endl; for(int i = 1; i < N-1; i++) { string t; t += S; t.push_back(v[0]); t += S; t.push_back(v[1]); t.push_back(v[0]); t += S; t.push_back(v[1]); t.push_back(v[1]); t += S; t.push_back(v[1]); t.push_back(v[2]); int x = press(t); if(x==i) { S.push_back(v[2]); } else if(x==i+1) { S.push_back(v[0]); } else { S.push_back(v[1]); } } if(N > 1) { string t; t = S; t.push_back(v[0]); if(press(t) == N) return t; t = S; t.push_back(v[1]); if(press(t) == N) return t; t = S; t.push_back(v[2]); // if(press(t) == N) return t; } return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...