Submission #232241

#TimeUsernameProblemLanguageResultExecution timeMemory
232241joaquinCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h" #include <iostream> std::using namespace std; std::string guess_sequence(int N) { string p,s=""; if(press("A")==1)s+="A"; else if(press("B")==1)s+="B"; else if(press("X")==1)s+="X"; else if(press("Y")==1)s+="Y"; if(press(s+"A")==2)s+="A"; else if(press(s+"B")==2)s+="B"; else if(press(s+"X")==2)s+="X"; else if(press(s+"Y")==2)s+="Y"; if(press(s+"A")==3)s+="A"; else if(press(s+"B")==3)s+="B"; else if(press(s+"X")==3)s+="X"; else if(press(s+"Y")==3)s+="Y"; return S; }

Compilation message (stderr)

combo.cpp:4:6: error: expected unqualified-id before 'using'
    4 | std::using namespace std;
      |      ^~~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:7:2: error: 'string' was not declared in this scope; did you mean 'std::string'?
    7 |  string p,s="";
      |  ^~~~~~
      |  std::string
In file included from /usr/include/c++/10/string:39,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/stringfwd.h:79:33: note: 'std::string' declared here
   79 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
combo.cpp:9:19: error: 's' was not declared in this scope
    9 |  if(press("A")==1)s+="A";
      |                   ^
combo.cpp:10:24: error: 's' was not declared in this scope
   10 |  else if(press("B")==1)s+="B";
      |                        ^
combo.cpp:11:24: error: 's' was not declared in this scope
   11 |  else if(press("X")==1)s+="X";
      |                        ^
combo.cpp:12:24: error: 's' was not declared in this scope
   12 |  else if(press("Y")==1)s+="Y";
      |                        ^
combo.cpp:14:11: error: 's' was not declared in this scope
   14 |  if(press(s+"A")==2)s+="A";
      |           ^
combo.cpp:19:11: error: 's' was not declared in this scope
   19 |  if(press(s+"A")==3)s+="A";
      |           ^
combo.cpp:24:10: error: 'S' was not declared in this scope
   24 |   return S;
      |          ^