Submission #1098707

#TimeUsernameProblemLanguageResultExecution timeMemory
1098707aren_danceCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int press(string p); string guess_sequence(int N){ int n=N; string s=""; string l1=""; l1+='A'; string l2=""; string l3=""; l2+='B'; l3+='X'; char c=; if(press[l1]==1){ s+=l1; c='A'; } else if(press[l2]==1){ s+=l2; c='B'; } else if(press[l3]==1){ s+=l3; c='X'; } else{ s+='Y'; C='Y'; } for(int i=1;i<=n;++i){ if(c=='A'){ string vec=s+'B'+s+'B'+s+'X'; int kal=press[vec]; if(kal==0){ s+='Y'; } if(kal==1){ s+='X'; } if(kal==2){ s+='B'; s+='B'; } } if(c=='B'){ string vec=s+'A'+s+'A'+s+'X'; int kal=press[vec]; if(kal==0){ s+='Y'; } if(kal==1){ s+='X'; } if(kal==2){ s+='A'; } } if(c=='X'){ string vec=s+'A'+s+'A'+s+'B'; int kal=press[vec]; if(kal==0){ s+='Y'; } if(kal==1){ s+='B'; } if(kal==2){ s+='A'; } } if(c=='Y'){ string vec=s+'A'+s+'A'+s+'B'; int kal=press[vec]; if(kal==0){ s+='X'; } if(kal==1){ s+='B'; } if(kal==2){ s+='A'; } } } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:13:12: error: expected primary-expression before ';' token
   13 |     char c=;
      |            ^
combo.cpp:14:13: error: no match for 'operator[]' (operand types are 'int(std::string)' {aka 'int(std::__cxx11::basic_string<char>)'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   14 |     if(press[l1]==1){
      |             ^
combo.cpp:18:18: error: no match for 'operator[]' (operand types are 'int(std::string)' {aka 'int(std::__cxx11::basic_string<char>)'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   18 |     else if(press[l2]==1){
      |                  ^
combo.cpp:22:18: error: no match for 'operator[]' (operand types are 'int(std::string)' {aka 'int(std::__cxx11::basic_string<char>)'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   22 |     else if(press[l3]==1){
      |                  ^
combo.cpp:28:9: error: 'C' was not declared in this scope
   28 |         C='Y';
      |         ^
combo.cpp:33:26: error: no match for 'operator[]' (operand types are 'int(std::string)' {aka 'int(std::__cxx11::basic_string<char>)'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   33 |             int kal=press[vec];
      |                          ^
combo.cpp:47:26: error: no match for 'operator[]' (operand types are 'int(std::string)' {aka 'int(std::__cxx11::basic_string<char>)'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   47 |             int kal=press[vec];
      |                          ^
combo.cpp:60:26: error: no match for 'operator[]' (operand types are 'int(std::string)' {aka 'int(std::__cxx11::basic_string<char>)'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   60 |             int kal=press[vec];
      |                          ^
combo.cpp:73:26: error: no match for 'operator[]' (operand types are 'int(std::string)' {aka 'int(std::__cxx11::basic_string<char>)'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   73 |             int kal=press[vec];
      |                          ^