Submission #972922

#TimeUsernameProblemLanguageResultExecution timeMemory
972922tamir1Combo (IOI18_combo)C++17
97 / 100
13 ms2120 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { string S,u; vector<string> v; if(press("A")){ S = "A"; u="BXY"; v={"BB","BX","BY","X"}; } else if(press("B")){ S = "B"; u="AXY"; v={"AA","AX","AY","X"}; } else if(press("X")){ S = "X"; u="ABY"; v={"AA","AB","AY","B"}; } else{ S = "Y"; u="ABX"; v={"AA","AB","AX","B"}; } if(N==1) return S; string p(N*4,S[0]); for(int i=1;i<N-1;i++){ p[i]=u[0]; p[i+1]=u[0]; p[N+i]=u[0]; p[N+i+1]=u[1]; p[2*N+i]=u[0]; p[2*N+i+1]=u[2]; p[3*N+i]=u[1]; int coin=press(p)-i; p[i]=u[2-coin]; p[N+i]=u[2-coin]; p[2*N+i]=u[2-coin]; p[3*N+i]=u[2-coin]; S+=u[2-coin]; } if(press(S+u[0])==N) S+=u[0]; else if(press(S+u[1])==N) S+=u[1]; else S+=u[2]; return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...