제출 #963832

#제출 시각아이디문제언어결과실행 시간메모리
963832Hezov콤보 (IOI18_combo)C++17
0 / 100
0 ms344 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string s = "";///Empty string. ///Find first character. if(press("AB")) { if(press("A")) s+="A"; else s+="B"; } else { if(press("X")) s+="X"; else s+="Y"; } ///First character found. char choices[3]; int poz = 0; if(s[0]!='A') choices[poz++] = 'A'; if(s[0]!='B') choices[poz++] = 'B'; if(s[0]!='X') choices[poz++] = 'C'; if(s[0]!='Y') choices[poz++] = 'Y'; ///Now we have all the choices. for(int i = 2;i<N;i++) { string p=""; ///sA sBA p =s + choices[0] + s + choices[1] + choices[0]; /// sBB p = s + choices[1] + s + choices[1]; /// sBC p = s + choices[1] + choices[2]; if(press(p)==i) s+=choices[0]; else if(press(p)==i+1) s+=choices[1]; else s+=choices[2]; } ///Now we need the last letter. if(press(s+choices[0])==N) s+=choices[0]; else if(press(s+choices[1])==N) s+=choices[1]; else s+=choices[2]; return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...