Submission #282000

#TimeUsernameProblemLanguageResultExecution timeMemory
282000ec1117Combo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" using namespace std; #define pb push_back #define mp make_pair string guess_sequence(int N){ string cur="";//default? if(press("AB")>0){ if(press("A")==1)cur="A"; else cur="B"; } else{ if(press("X")==1)cur="X"; else cur="Y"; } set<string> set={"A","B","X","Y"}; set.erase(cur); while(cur.length()<N){ if(cur.length()==N-1){ if(press(cur+*next(set.begin(),1))==N){ return cur+*next(set.begin(),1); } else if(press(cur+*next(set.begin(),2))==N){ return cur+*next(set.begin(),2); } else{ return cur+*next(set.begin(),3); } } else{ string tmp=cur+*next(set.begin(),1)+*next(set.begin(),1)+cur+*next(set.begin(),1)+*next(set.begin(),2)+cur+*next(set.begin(),1)+*next(set.begin(),3)+cur+*next(set.begin(),2); int x=press(tmp); if((int)x==cur.length()+2){ cur+=*next(set.begin(),1); } else if(x==cur.length()+1){ cur+=*next(set.begin(),2); } else{ cur+=*next(set.begin(),3); } } } }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:8: error: 'press' was not declared in this scope
    9 |     if(press("AB")>0){
      |        ^~~~~
combo.cpp:19:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   19 |     while(cur.length()<N){
      |           ~~~~~~~~~~~~^~
combo.cpp:20:24: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |         if(cur.length()==N-1){
      |            ~~~~~~~~~~~~^~~~~
combo.cpp:21:16: error: 'press' was not declared in this scope
   21 |             if(press(cur+*next(set.begin(),1))==N){
      |                ^~~~~
combo.cpp:33:19: error: 'press' was not declared in this scope
   33 |             int x=press(tmp);
      |                   ^~~~~
combo.cpp:34:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |             if((int)x==cur.length()+2){
      |                ~~~~~~^~~~~~~~~~~~~~~~
combo.cpp:37:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |             else if(x==cur.length()+1){
      |                     ~^~~~~~~~~~~~~~~~
combo.cpp:8:16: warning: control reaches end of non-void function [-Wreturn-type]
    8 |     string cur="";//default?
      |                ^~