Submission #1293356

#TimeUsernameProblemLanguageResultExecution timeMemory
1293356settopCombo (IOI18_combo)C++20
5 / 100
1 ms400 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; #define sz(x) (int)x.size() #define pb push_back #define fall(i,a,b) for(int i=a;i<=b;i++) char get(string v,string s){ if(sz(v)==1) return v[0]; string l="",r="",t1="",t2=""; fall(i,0,sz(v)/2-1){ l+=s; l+=v[i]; t1+=v[i]; } fall(i,sz(v)/2,sz(v)-1){ r+=s; r+=v[i]; t2+=v[i]; } int x=press(l); if(x>=sz(s)+1) return get(t1,s); else return get(t2,s); } string guess_sequence(int n) { char c=get("ABXY",""); string pos="ABXY"; string s=""; for(auto u:pos) if(u!=c) s+=u; string ans=""; ans+=c; fall(i,2,n-1){ string aux=""; fall(j,0,2) aux+=ans,aux+=s[0],aux+=s[j]; aux+=ans,aux+=s[1]; int x=press(aux); if(x==i-1) ans+=s[2]; else if(x==i) ans+=s[1]; else ans+=s[0]; } ans+=get(s,ans); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...