Submission #783181

#TimeUsernameProblemLanguageResultExecution timeMemory
783181Mouad_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++; } } for(int y=1;y<n-1;y++) { string cur=ans+ntab[2]+ans+ntab[1]+ntab[1]+ans+ntab[1]+ntab[2]+ans+ntab[1]+ntab[0]; int ca=press(cur); if(ca==y) ans+=ntab[0]; else if(ca==y+1) ans+=ntab[2]; else ans+=ntab[1]; } if(press(ans+ntab[0])==n) ans+=ntab[0]; else if(press(ans+ntab[1])==n) ans+=ntab[1]; else if(press(ans+ntab[2])==n) ans+=ntab[2]; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...