제출 #587313

#제출 시각아이디문제언어결과실행 시간메모리
587313APROHACK콤보 (IOI18_combo)C++14
100 / 100
36 ms536 KiB
#include "combo.h" #include <bits/stdc++.h> #define PB push_back using namespace std; string guess_sequence(int N) { string moves[4]={"A", "B", "X", "Y"}; string str = ""; string q1="AB", q2="XY"; if(press(q1)){ if(press(moves[0]))str=moves[0]; else str=moves[1]; }else{ if(press(moves[2]))str=moves[2]; else str=moves[3]; } string S = str, last; if(N==1)return S; vector<string>newmoves; for(int i = 0 ; i < 4 ; i++){ if(moves[i]!=S)newmoves.PB(moves[i]); } for (int i = 1; i < N-1; i++) { string nxt = newmoves[0]; int ans=press(S+newmoves[1]+S+newmoves[2]+newmoves[0]+S+newmoves[2]+newmoves[1]+S+newmoves[2]+newmoves[2]); if(ans==i+1)S+=newmoves[1]; else if(ans>i+1)S+=newmoves[2]; else S+=nxt; } if(press(S+newmoves[0])==N)S+=newmoves[0]; else if(press(S+newmoves[1])==N)S+=newmoves[1]; else S+=newmoves[2]; return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...