제출 #873980

#제출 시각아이디문제언어결과실행 시간메모리
873980kh0i콤보 (IOI18_combo)C++17
5 / 100
1 ms596 KiB
#include "combo.h" #include "bits/stdc++.h" using namespace std; #define sz(x) (int)(x).size() string guess_sequence(int N) { string p = ""; string S = ""; int a, b, x; a = b = x = 0; if(press("AB")){ if(press("A")) a = 1; else b = 1; } else{ if(press("X")) x = 1; } if(a) S = "A"; else if(b) S = "B"; else if(x) S = "X"; else S = "Y"; vector<string> choice; if(a) choice = {"B", "XX", "XB", "XY", "Y"}; else if(b) choice = {"A", "XX", "XA", "XY", "Y"}; else if(x) choice = {"A", "BB", "BA", "BY", "Y"}; else choice = {"A", "BB", "BA", "BX", "X"}; for(int i = 1; i < N - 1; ++i){ string to_press = ""; for(int j = 0; j < 4; ++j){ // cerr << S << ' ' << choice[j] << endl; to_press += S + choice[j]; } int len = press(to_press); if(len == sz(S)) S = S + choice.back(); else if(len == sz(S) + 1) S.push_back(choice.front().front()); else S.push_back(choice[1].front()); } if(press(S + choice[0]) == sz(S) + 1) S += choice[0]; else if(press(S + choice[1][0]) == sz(S) + 1) S += choice[1][0]; else S += choice.back(); return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...