Submission #261627

#TimeUsernameProblemLanguageResultExecution timeMemory
261627AASGCombo (IOI18_combo)C++11
100 / 100
41 ms808 KiB
#include "combo.h" std::string guess_sequence(int N) { std::string p = ""; std::string L = "ABXY"; std::string S; if(press("AB")>0){ if(press("A")>0){ S="A"; L="BXY"; }else{ S="B"; L="AXY"; } }else{ if(press("X")>0){ S="X"; L="ABY"; }else{ S="Y"; L="ABX"; } } int coins=1, x=0, c=0; for(int i=1;i<N-1;i++){ x=press(S+L[0]+L[0]+S+L[0]+L[1]+S+L[0]+L[2]+S+L[1]); if(x-coins==2) S=S+L[0]; else if(x-coins==1) S=S+L[1]; else if(x-coins==0) S=S+L[2]; coins++; } if(coins<N){ if(press(S+"A"+S+"B")>coins){ if(press(S+"A")>coins){ S=S+"A"; }else{ S=S+"B"; } }else{ if(press(S+"X")>coins){ S=S+"X"; }else{ S=S+"Y"; } } } return S; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:24:21: warning: unused variable 'c' [-Wunused-variable]
   24 |   int coins=1, x=0, c=0;
      |                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...