Submission #282012

#TimeUsernameProblemLanguageResultExecution timeMemory
282012ec1117Combo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" using namespace std; #define pb push_back #define mp make_pair int x; string tmp; 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{ 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]; } } } }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:10:8: error: 'press' was not declared in this scope
   10 |     if(press("AB")>0){
      |        ^~~~~
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:27:16: error: 'press' was not declared in this scope
   27 |             if(press(cur+vec[0])==N){
      |                ^~~~~
combo.cpp:39:15: error: 'press' was not declared in this scope
   39 |             x=press(tmp);
      |               ^~~~~
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){
      |                     ~^~~~~~~~~~~~~~
combo.cpp:9:16: warning: control reaches end of non-void function [-Wreturn-type]
    9 |     string cur="";
      |                ^~