제출 #501180

#제출 시각아이디문제언어결과실행 시간메모리
501180Kripton콤보 (IOI18_combo)C++14
100 / 100
37 ms592 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int n) { if(n==1) { if(press("A")==0) { if(press("B")==0) { if(press("X")==0) return "Y"; return "X"; } return "B"; } return "A"; } else { string s=""; if (press("AB") == 0) { if (press("X") == 0) s+="Y"; else s+="X"; } else { if (press("A") == 0) s+="B"; else s+="A"; } char a,b,c; if(s[0]=='A') { a='B'; b='X'; c='Y'; } if(s[0]=='B') { a='A'; b='X'; c='Y'; } if(s[0]=='X') { a='B'; b='A'; c='Y'; } if(s[0]=='Y') { a='B'; b='X'; c='A'; } for(int i=2; i<n; i++) { int q=press(s+a+s+b+a+s+b+c+s+b+b); if(q==i) s+=a; else if(q==i+1) s+=b; else s+=c; } int q=press(s+c); if(q==n) s+=c; else { q=press(s+a); if(q==n) s+=a; else s+=b; } return s; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...