Submission #228122

#TimeUsernameProblemLanguageResultExecution timeMemory
228122Romario8Combo (IOI18_combo)C++17
0 / 100
1 ms328 KiB
#include<bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<b;i++) #define rrep(i,a,b) for(int i=a;i>=b;i--) #define pb push_back #define rl "\n" #define ll long long #include "combo.h" using namespace std; string guess_sequence(int N) { int n=N; if(n==1) { string s=""; s+="A"; int a=press(s); if(a==1) { return s; } s="B"; a=press(s); if(a==1) return s; s="X"; a=press(s); if(a==1) return s; s="Y"; return s; } string ans=""; string g1="XY",g2="AB"; if(press(g1)==0)swap(g1,g2); string s1=""; s1+=g1[0]; string s2=""; s2+=g1[1]; string s3=""; char a='A',b='B',x='X',y='Y'; string p1=""; if(press(s1)==1)ans+=s1[0]; else ans+=s2[0]; if(ans[0]==a)swap(a,y); else if(ans[0]==b)swap(b,y); else if(ans[0]==x)swap(x,y); s1=ans+a; s2=ans+b; s3=ans+x; p1=s1+a+s1+b+s1+x+s2; while((int)(ans.size())!=n-1) { int pr=press(p1); if(pr==(int)(ans.size())+2) { ans=s1; } else if(pr==(int)(ans.size())+1) { ans=s2; } else { ans=s3; } s1=ans+a; s2=ans+b; s3=ans+x; p1=s1+a+s1+b+s1+x+s2; cout<<p1.size()<<rl; } string res=""; res+=ans+a+ans+b; int pr1=press(res); if(pr1==n) { res=ans+a; pr1=press(res); if(pr1==n) { ans+=a; } else ans+=b; return ans; } else { ans+=x; return ans; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...