Submission #890732

#TimeUsernameProblemLanguageResultExecution timeMemory
890732kokoueCombo (IOI18_combo)C++14
100 / 100
15 ms2112 KiB
#include<bits/stdc++.h> #include "combo.h" std::string guess_sequence(int N) { std::string p = ""; std::string S = ""; p="AX"; std::string let; int bid; int coins=press(p); if(coins>=1) { p="A"; coins=press(p); if(coins==1) {S+="A";let="XBY";} else {S+="X";let="ABY";} } else { p="B"; coins=press(p); if(coins==1) {S+="B";let="AXY";} else {S+="Y";let="AXB";} } //std::cout<<"Current s = "<<S<<"\n"; if(N==1) return S; for(int i=1;i<N-1;i++) { p=""; p=S+let[0]; p+=S+let[1]+let[0]; p+=S+let[1]+let[1]; p+=S+let[1]+let[2]; coins=press(p); // std::cout<<"Press returned: "<<coins-i<<"\n"; if(coins==1+i) S+=let[0]; if(coins==2+i) S+=let[1]; if(coins==0+i) S+=let[2]; // std::cout<<"Current s = "<<S<<"\n"; } p=S+let[0]; p+=S+let[1]; coins=press(p); if(coins==N-1) S+=let[2]; else { p=S+let[0]; coins=press(p); if(coins==N-1) S+=let[1]; if(coins==N) S+=let[0]; } //std::cout<<"Current s = "<<S<<"\n"; return S; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:7: warning: unused variable 'bid' [-Wunused-variable]
    9 |   int bid;
      |       ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...