제출 #341626

#제출 시각아이디문제언어결과실행 시간메모리
341626BlancaHM콤보 (IOI18_combo)C++14
100 / 100
42 ms556 KiB
#include "combo.h" #include <vector> using namespace std; string guess_sequence(int N) { string S; char first; int x = press("AB"); if (x == 2) { S = "AB"; first = 'A'; } else if (x == 1) { x = press("A"); if (x) { first = 'A'; S = "A"; } else { first = 'B'; S = "B"; } } else { x = press("X"); if (x) { first = 'X'; S = "X"; } else { first = 'Y'; S = "Y"; } } vector<string> pos; if (first != 'A') pos.push_back("A"); if (first != 'B') pos.push_back("B"); if (first != 'X') pos.push_back("X"); if (first != 'Y') pos.push_back("Y"); while((int) S.length() < N) { if (3*((int) S.length() + 2) + (int) S.length() + 1 <= 4*N) { x = press(S + pos[0] + pos[0] + S + pos[0] + pos[1] + S + pos[0] + pos[2] + S + pos[1]); if (x == (int) S.length() + 2) S += pos[0]; else if (x == (int) S.length() + 1) S += pos[1]; else S += pos[2]; } else { x = press(S + pos[0]); if(x == (int) S.length() + 1) { S += pos[0]; continue; } x = press(S + pos[1]); if (x == (int) S.length() + 1) S += pos[1]; else S += pos[2]; } } return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...