Submission #644555

#TimeUsernameProblemLanguageResultExecution timeMemory
644555tigarCombo (IOI18_combo)C++14
5 / 100
1 ms280 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string rezz=""; char slova[]={'A', 'B', 'X', 'Y'}; int begg=0; int br=press("AB"); if(br>=1) { br=press("A"); if(br==1){rezz+="A"; begg=0;} else {rezz+="B"; begg=1;} } else if(br==0) { br=press("X"); if(br==1){rezz+="X"; begg=2;} else {rezz+="Y"; begg=3;} } for(int i=1; i<N-1; i++) { string prs=rezz+slova[(begg+1)%4]+slova[(begg+1)%4]; prs+=rezz+slova[(begg+1)%4]+slova[(begg+2)%4]; prs+=rezz+slova[(begg+1)%4]+slova[(begg+3)%4]; prs+=rezz+slova[(begg+2)%4]; int lnght=press(prs); if(lnght==i+2)rezz+=slova[(begg+1)%4]; else if(lnght==i+1)rezz+=slova[(begg+2)%4]; else rezz+=slova[(begg+3)%4]; } if(press(rezz+slova[(begg+1)%4])==N)return rezz+slova[(begg+1)%4]; else if(press(rezz+slova[(begg+2)%4])==N)return rezz+slova[(begg+2)%4]; else return rezz+slova[(begg+3)%4]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...