Submission #316584

#TimeUsernameProblemLanguageResultExecution timeMemory
316584FatihSolakCombo (IOI18_combo)C++17
100 / 100
46 ms680 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N){ string res="",p="AB",s="ABXY"; int st; if(press(p)){ p="A"; if(press(p)){ res+='A'; st=0; } else{ res+='B'; st=1; } } else{ p='X'; if(press(p)){ res+='X'; st=2; } else{ res+='Y'; st=3; } } if(N==1) return res; char c1=s[(st+1)%4]; char c2=s[(st+2)%4]; char c3=s[(st+3)%4]; for(int i=2;i<N;i++){ p=""; p+=res+c1+c1+res+c1+c2+res+c1+c3+res+c2; int a=press(p); if(a == i)res+=c2; else if(a == i+1)res+=c1; else res+=c3; } p=""; p+=res+c1; if(press(p) == N){ res+=c1; } else{ p=""; p+=res+c2; if(press(p) == N) res+=c2; else { res+=c3; } } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...