Submission #282013

#TimeUsernameProblemLanguageResultExecution timeMemory
282013ec1117Combo (IOI18_combo)C++17
100 / 100
42 ms628 KiB
#include "bits/stdc++.h" #include "combo.h" using namespace std; #define pb push_back #define mp make_pair int x; string guess_sequence(int N){ string cur=""; if(press("AB")>0){ if(press("A")==1)cur="A"; else cur="B"; } else{ if(press("X")==1)cur="X"; else cur="Y"; } vector<char> vec{'A','B','X','Y'}; for(int i=0;i<4;i++){ if(vec[i]==cur[0]){ vec.erase(vec.begin()+i); break; } } while(cur.size()<N){ if(cur.size()==N-1){ if(press(cur+vec[0])==N){ return cur+vec[0]; } else if(press(cur+vec[1])==N){ return cur+vec[1]; } else{ return cur+vec[2]; } } else{ string tmp=cur+vec[0]+vec[0]+cur+vec[0]+vec[1]+cur+vec[0]+vec[2]+cur+vec[1]; x=press(tmp); if(x==cur.size()+2){ cur+=vec[0]; } else if(x==cur.size()+1){ cur+=vec[1]; } else{ cur+=vec[2]; } } } return cur; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:25:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   25 |     while(cur.size()<N){
      |           ~~~~~~~~~~^~
combo.cpp:26:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   26 |         if(cur.size()==N-1){
      |            ~~~~~~~~~~^~~~~
combo.cpp:40:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |             if(x==cur.size()+2){
      |                ~^~~~~~~~~~~~~~
combo.cpp:43:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |             else if(x==cur.size()+1){
      |                     ~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...