Submission #783168

#TimeUsernameProblemLanguageResultExecution timeMemory
783168Mouad_oujCombo (IOI18_combo)C++17
5 / 100
1 ms208 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int n) { string tab[4]={"A","B","X","Y"}; int c=0,c1=0; string ans=""; for(int x=0;x<3;x++) { if(press(tab[x])==1) { c=x; break; } if(c==0 && x==2) c=x+1; } ans+=tab[c]; string ntab[3]; for(int x=0;x<4;x++) { if(x!=c) { ntab[c1]=tab[x]; c1++; } } int ca=0; for(int y=1;y<n-1;y++) { string cur=ans+ntab[0]+ans+ntab[1]+ntab[1]+ans+ntab[1]+ntab[2]+ans+ntab[1]+ntab[0]; ca=press(cur); if(ca==y) ans+=ntab[2]; else if(ca==y+1) ans+=ntab[0]; else ans+=ntab[1]; } ca=press(ans); if(press(ans+ntab[0])==ca+1) ans+=ntab[0]; else if(press(ans+ntab[1])==ca+1) ans+=ntab[1]; else ans+=ntab[2]; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...