Submission #270602

#TimeUsernameProblemLanguageResultExecution timeMemory
270602nafis_shifatCombo (IOI18_combo)C++14
100 / 100
42 ms648 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string guess_sequence(int N) { if(N==1) { int k=press("A"); if(k==1) return "A"; k=press("B"); if(k==1) return "B"; k=press("X"); if(k==1) return "X"; return "Y"; } int k=press("ABA"); char c; if(k==0) { if(press("X")) c='X'; else c='Y'; } else { if(press("A")) c='A'; else c='B'; } string res=""; res+=c; char a[3]={'A','B','X'}; if(c=='A')a[0]='Y'; if(c=='B')a[1]='Y'; if(c=='X')a[2]='Y'; for(int i=2;i<N;i++) { int z=res.size()+1; string tmp=res+a[0]+a[1]+res+a[0]+a[0]+res+a[0]+a[2]+res+a[1]; int r=press(tmp); if(r==z)res+=a[1]; else if(r>z)res+=a[0]; else res+=a[2]; } if(press(res+a[0])==N)res+=a[0]; else if(press(res+a[1])==N)res+=a[1]; else res+=a[2]; return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...