Submission #739013

#TimeUsernameProblemLanguageResultExecution timeMemory
739013raul2008487Combo (IOI18_combo)C++17
100 / 100
31 ms572 KiB
#include<bits/stdc++.h> #define pb push_back using namespace std; #include "combo.h" std::string guess_sequence(int N) { std::string s=""; int cc=1,st; int cs1=press("AB"),cs2=press("AX"); std::vector<char> vec; if(cs1==2){ s+="AB"; vec.pb('B'); vec.pb('X'); vec.pb('Y'); } else if(cs2==2){ s+="AX"; vec.pb('B'); vec.pb('X'); vec.pb('Y'); } else if(cs1==1 && cs2==1){ s+="A"; vec.pb('B'); vec.pb('X'); vec.pb('Y'); } else if(cs1==1){ s+='B'; vec.pb('A'); vec.pb('X'); vec.pb('Y'); } else if(cs2==1){ s+='X'; vec.pb('A'); vec.pb('B'); vec.pb('Y'); } else{ s+='Y'; vec.pb('B'); vec.pb('X'); vec.pb('A'); } st=s.size(); if(st==N){ return s; } for(int i=st;i<N-1;i++){ int query=press(s+vec[0]+s+vec[1]+vec[0]+s+vec[1]+vec[1]+s+vec[1]+vec[2]); if(query==(i+1)){ s+=vec[0]; } else if(query==(i+2)){ s+=vec[1]; } else{ s+=vec[2]; } } if(press(s+vec[0])==N){ return s+vec[0]; } else if(press(s+vec[1])==N){ return s+vec[1]; } return s+vec[2]; }

Compilation message (stderr)

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