제출 #667062

#제출 시각아이디문제언어결과실행 시간메모리
667062irmuun콤보 (IOI18_combo)C++17
100 / 100
39 ms524 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; #define pb push_back #define ll long long char ch[4]; string s=""; string add(int x,int y){ string t=s; t+=ch[x]; t+=ch[y]; return t; } string guess_sequence(int n){ if(press("AB")){ if(press("A")>0){ s+='A'; } else{ s+='B'; } } else{ if(press("X")>0){ s+='X'; } else{ s+='Y'; } } if(n==1){ return s; } int cur=0; string button="ABXY"; for(int i=0;i<4;i++){ if(s[0]!=button[i]){ ch[cur]=button[i]; cur++; } } for(int i=1;i<n-1;i++){ string t=s+ch[0]+ch[0]+s+ch[0]+ch[1]+s+ch[0]+ch[2]+s+ch[1]; int x=press(t); if(x==i+2){ s+=ch[0]; } else if(x==i+1){ s+=ch[1]; } else{ s+=ch[2]; } } if(press(s+ch[0])==n){ s+=ch[0]; } else if(press(s+ch[1])==n){ s+=ch[1]; } else{ s+=ch[2]; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...