제출 #1323462

#제출 시각아이디문제언어결과실행 시간메모리
1323462_aira콤보 (IOI18_combo)C++20
100 / 100
8 ms476 KiB
#include<bits/stdc++.h> using namespace std; #define endl '\n' #define pb push_back #define ff first #define ss second #define all(a) a.begin(),a.end() #define gcd(a,b) __gcd(a,b) #define lcm(a,b) (a*(b/gcd(a,b))) #define fios(); ios_base::sync_with_stdio(0);cin.tie(0); #define file(); freopen("input.txt","r",stdin);freopen("output.txt","w",stdout); int press(string p); string guess_sequence(int N){ string ans="",s=""; if(press("AB")!=0) { if(press("A")==1){ ans="A"; s="BXY"; }else{ ans="B"; s="AXY"; } } else if(press("X")==1) { ans="X"; s="ABY"; } else { ans="Y"; s="ABX"; } if(N==1) return ans; for(int i=2;i<=N;i++){ if(i==N){ if(press(ans+s[0])==N) ans+=s[0]; else if(press(ans+s[1])==N) ans+=s[1]; else ans+=s[2]; continue; } int k=press(ans+s[0]+ans+s[1]+s[0]+ans+s[1]+s[1]+ans+s[1]+s[2]); if(k==ans.size()+1){ ans+=s[0]; } else if(k==ans.size()+2){ ans+=s[1]; } else ans+=s[2]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...