Submission #282926

#TimeUsernameProblemLanguageResultExecution timeMemory
282926tinjyuCombo (IOI18_combo)C++14
100 / 100
44 ms716 KiB
#include "combo.h" #include <iostream> using namespace std; string guess_sequence(int N) { string p = "",S = ""; char t; int coins; p="AB"; coins = press(p); if(coins>=1) { p="A"; coins = press(p); if(coins==1) { S="A"; t=1; } else { S="B"; t=2; } } else { p="X"; coins = press(p); if(coins==1) { S="X"; t=3; } else { S="Y"; t=4; } } if(N==1)return S; ///cout<<S<<endl; char a,b,c; if(t==1){a='B',b='X',c='Y';} if(t==2){a='A',b='X',c='Y';} if(t==3){a='A',b='B',c='Y';} if(t==4){a='A',b='B',c='X';} for(int i=2;i<N;i++) { string tmp=S; p=tmp+a; p+=tmp+b+a; p+=tmp+b+b; p+=tmp+b+c; //cout<<tmp<<" "<<a<<" "<<b<<" "<<c<<endl; coins = press(p); if(coins==i-1)S+=c; if(coins==i)S+=a; if(coins==i+1)S+=b; //cout<<S<<endl; } p=S+a+S+b; coins = press(p); if(coins==N) { p=S+a; coins = press(p); if(coins==N)S+=a; else S+=b; } else S+=c; return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...