제출 #1128606

#제출 시각아이디문제언어결과실행 시간메모리
1128606Mathias콤보 (IOI18_combo)C++20
0 / 100
0 ms408 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; /*string s1,s2; int press(string s3){ int r=0; for(int j=0;j<s3.size();j++){ for(int i=0;i+j<s3.size() and i<s1.size();i++){ if(s3[j+i]!=s1[i]) break; r=max(r,i+1); } } cout<<r<<'\n'; return r; }*/ string guess_sequence(int N) { string p="", ans=""; int x; p="AB"; x=press(p); if(x==0){ p="X", x=press(p); if(x==0) ans="Y"; else ans="X"; } else{ p="A", x=press(p); if(x==0) ans="B"; else ans="A"; } cout<<ans<<'\n'; for(int i=2;i<=N-1;i++){ if(ans[0]=='A'){ p=ans+"B"+ans+"XY"+ans+"XX"+ans+"XB", x=press(p); cout<<p<<' '<<x<<'\n'; if(x==i-1) ans+="Y"; else if(x==i) ans+="B"; else ans+="X"; } else if(ans[0]=='X'){ p=ans+"B"+ans+"AY"+ans+"AB"+ans+"AA", x=press(p); if(x==i-1) ans+="Y"; else if(x==i) ans+="B"; else ans+="A"; } else if(ans[0]=='B'){ p=ans+"Y"+ans+"XY"+ans+"XX"+ans+"XB", x=press(p); if(x==i-1) ans+="A"; else if(x==i) ans+="Y"; else ans+="X"; } else if(ans[0]=='Y'){ p=ans+"B"+ans+"XA"+ans+"XX"+ans+"XB", x=press(p); if(x==i-1) ans+="A"; else if(x==i) ans+="B"; else ans+="X"; } } cout<<ans<<'\n'; p=ans+"A"+ans+"B"; x=press(p); if(x==ans.size()){ p=ans+"X", x=press(p); if(x==ans.size()) ans+="Y"; else ans+="X"; } else{ p=ans+"A", x=press(p); if(x==ans.size()) ans+="B"; else ans+="A"; } return ans; }/* int main(){ cin>>s1; s2=guess_sequence(s1.size()); if(s1==s2) cout<<"YES\n"; else cout<<"NO\n"; }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...