Submission #696451

#TimeUsernameProblemLanguageResultExecution timeMemory
696451Elvin_FritlCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "combo.h" using namespace std; string guess_sequence(int n) { string p = ""; string s="ABXY"; for(int i=0;i<3;i++){ string p1+=s[i]; if(press(p1)==1){ p=p1; break; } } if(p.size()==0){ p+=s[3]; } string s2=""; for(int i=0;i<3;i++){ if(p[0]!=s[i]){ s2+=s[i]; } } s=s2; for(int i=1;i<n;i++){ for(int j=0;j<2;j++){ string p1=p+s[j]; if(press(p1)==p1.size()){ p=p1; break; } } int kk=i; if(p.size()==kk){ p+=s[2]; } } return p; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:7:18: error: expected initializer before '+=' token
    7 |         string p1+=s[i];
      |                  ^~
combo.cpp:8:18: error: 'p1' was not declared in this scope; did you mean 'p'?
    8 |         if(press(p1)==1){
      |                  ^~
      |                  p
combo.cpp:26:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         if(press(p1)==p1.size()){
      |            ~~~~~~~~~^~~~~~~~~~~
combo.cpp:32:16: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   32 |     if(p.size()==kk){
      |        ~~~~~~~~^~~~