Submission #1216036

#TimeUsernameProblemLanguageResultExecution timeMemory
1216036gabyferaqCombo (IOI18_combo)C++20
5 / 100
0 ms408 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string guess_sequence(int N) { string p = ""; if(press("AB")) { if(press("A")) p+="A"; else p+="B"; } else { if(press("X")) p+="X"; else p+="Y"; } vector <string> aux; if(p=="A") aux={"B","XB","XX","XY"}; if(p=="B") aux={"A","XA","XX","XY"}; if(p=="X") aux={"A","BA","BB","BY"}; if(p=="Y") aux={"A","BA","BB","BX"}; for (int i=1;i<N-1;i++) { int r=p.size(); int val=press(p+aux[0]+p+aux[1]+p+aux[2]+p+aux[3]); if(p[0]=='A') { if(val==r) p+="Y"; if(val==r+1) p+="B"; if(val==r+2) p+="X"; } if(p[0]=='B') { if(val==r) p+="Y"; if(val==r+1) p+="A"; if(val==r+2) p+="X"; } if(p[0]=='X') { if(val==r) p+="Y"; if(val==r+1) p+="A"; if(val==r+2) p+="B"; } if(p[0]=='Y') { if(val==r) p+="X"; if(val==r+1) p+="A"; if(val==r+2) p+="B"; } } if(press(p+"A"+p+"B")==N) { if(press(p+"A")==N) p+="A"; else p+="B"; } else { if(press(p+"X")==N) p+="X"; else p+="Y"; } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...