제출 #108472

#제출 시각아이디문제언어결과실행 시간메모리
108472abil콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" #define int long long #define mk make_pair #define sc second #define fr first #define pb emplace_back #define all(s) s.begin(), s.end() #define sz(s) ( (int)s.size() ) #define Scan(a) scanf ("%I64d", &a) #define scan(a) scanf ("%d", &a) using namespace std; const long long INF = (int)1e18 + 7; const int N = (int)1e5 + 12; const int mod = 1000000007; string guess_sequence(int N){ string s = "", s1 = "AB"; int cur = press(string s1); if(cur == 2){ s = "A"; } else if(cur == 1){ cur = press(string "A"); if(cur == 1){ s = "A"; } else{ s = "B"; } } else{ s1 = "XY"; int cur = press(string s1); if(cur == 2){ s = "X"; } else if(cur == 1){ cur = press(string "X"); if(cur == 1){ s = "X"; } else{ s = "Y"; } } } char ch = s[0]; if(s.size() == N){ return s; } if(ch == 'A'){ while(s.size() < N){ string s1 = s; s1.pb('B'); s1.pb('X'); s1 = s1 + s; s1.pb('B'); s1.pb('Y'); s1 = s1 + s; s1.pb('Y'); cur = press(string s1); if(cur == s.size()){ s.pb('X'); } else if(cur == s.size() + 1){ s.pb('Y'); } else{ s.pb('B'); } } return s; } if(ch == 'B'){ while(s.size() < N){ string s1 = s; s1.pb('A'); s1.pb('X'); s1 = s1 + s; s1.pb('A'); s1.pb('Y'); s1 = s1 + s; s1.pb('Y'); cur = press(string s1); if(cur == s.size()){ s.pb('X'); } else if(cur == s.size() + 1){ s.pb('Y'); } else{ s.pb('A'); } } return s; } if(ch == 'X'){ while(s.size() < N){ string s1 = s; s1.pb('B'); s1.pb('A'); s1 = s1 + s; s1.pb('B'); s1.pb('Y'); s1 = s1 + s; s1.pb('Y'); cur = press(string s1); if(cur == s.size()){ s.pb('A'); } else if(cur == s.size() + 1){ s.pb('Y'); } else{ s.pb('B'); } } return s; } if(ch == 'Y'){ while(s.size() < N){ string s1 = s; s1.pb('B'); s1.pb('X'); s1 = s1 + s; s1.pb('B'); s1.pb('A'); s1 = s1 + s; s1.pb('A'); cur = press(string s1); if(cur == s.size()){ s.pb('X'); } else if(cur == s.size() + 1){ s.pb('A'); } else{ s.pb('B'); } } return s; } }

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'std::string guess_sequence(long long int)':
combo.cpp:21:30: error: expected primary-expression before 's1'
   21 |       int cur = press(string s1);
      |                              ^~
combo.cpp:27:32: error: expected primary-expression before string constant
   27 |             cur = press(string "A");
      |                                ^~~
combo.cpp:37:36: error: expected primary-expression before 's1'
   37 |             int cur = press(string s1);
      |                                    ^~
combo.cpp:43:38: error: expected primary-expression before string constant
   43 |                   cur = press(string "X");
      |                                      ^~~
combo.cpp:53:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   53 |       if(s.size() == N){
      |          ~~~~~~~~~^~~~
combo.cpp:57:28: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   57 |             while(s.size() < N){
      |                   ~~~~~~~~~^~~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:59:22: note: in expansion of macro 'pb'
   59 |                   s1.pb('B');
      |                      ^~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:60:22: note: in expansion of macro 'pb'
   60 |                   s1.pb('X');
      |                      ^~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:62:22: note: in expansion of macro 'pb'
   62 |                   s1.pb('B');
      |                      ^~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:63:22: note: in expansion of macro 'pb'
   63 |                   s1.pb('Y');
      |                      ^~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:65:22: note: in expansion of macro 'pb'
   65 |                   s1.pb('Y');
      |                      ^~
combo.cpp:66:38: error: expected primary-expression before 's1'
   66 |                   cur = press(string s1);
      |                                      ^~
combo.cpp:67:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   67 |                   if(cur == s.size()){
      |                      ~~~~^~~~~~~~~~~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:68:27: note: in expansion of macro 'pb'
   68 |                         s.pb('X');
      |                           ^~
combo.cpp:71:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   71 |                   if(cur == s.size() + 1){
      |                      ~~~~^~~~~~~~~~~~~~~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:72:27: note: in expansion of macro 'pb'
   72 |                         s.pb('Y');
      |                           ^~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:75:27: note: in expansion of macro 'pb'
   75 |                         s.pb('B');
      |                           ^~
combo.cpp:81:28: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   81 |             while(s.size() < N){
      |                   ~~~~~~~~~^~~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:83:22: note: in expansion of macro 'pb'
   83 |                   s1.pb('A');
      |                      ^~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:84:22: note: in expansion of macro 'pb'
   84 |                   s1.pb('X');
      |                      ^~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:86:22: note: in expansion of macro 'pb'
   86 |                   s1.pb('A');
      |                      ^~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:87:22: note: in expansion of macro 'pb'
   87 |                   s1.pb('Y');
      |                      ^~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:89:22: note: in expansion of macro 'pb'
   89 |                   s1.pb('Y');
      |                      ^~
combo.cpp:90:38: error: expected primary-expression before 's1'
   90 |                   cur = press(string s1);
      |                                      ^~
combo.cpp:91:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   91 |                   if(cur == s.size()){
      |                      ~~~~^~~~~~~~~~~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:92:27: note: in expansion of macro 'pb'
   92 |                         s.pb('X');
      |                           ^~
combo.cpp:95:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   95 |                   if(cur == s.size() + 1){
      |                      ~~~~^~~~~~~~~~~~~~~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:96:27: note: in expansion of macro 'pb'
   96 |                         s.pb('Y');
      |                           ^~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:99:27: note: in expansion of macro 'pb'
   99 |                         s.pb('A');
      |                           ^~
combo.cpp:105:28: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
  105 |             while(s.size() < N){
      |                   ~~~~~~~~~^~~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:107:22: note: in expansion of macro 'pb'
  107 |                   s1.pb('B');
      |                      ^~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:108:22: note: in expansion of macro 'pb'
  108 |                   s1.pb('A');
      |                      ^~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:110:22: note: in expansion of macro 'pb'
  110 |                   s1.pb('B');
      |                      ^~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:111:22: note: in expansion of macro 'pb'
  111 |                   s1.pb('Y');
      |                      ^~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:113:22: note: in expansion of macro 'pb'
  113 |                   s1.pb('Y');
      |                      ^~
combo.cpp:114:38: error: expected primary-expression before 's1'
  114 |                   cur = press(string s1);
      |                                      ^~
combo.cpp:115:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  115 |                   if(cur == s.size()){
      |                      ~~~~^~~~~~~~~~~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:116:27: note: in expansion of macro 'pb'
  116 |                         s.pb('A');
      |                           ^~
combo.cpp:119:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  119 |                   if(cur == s.size() + 1){
      |                      ~~~~^~~~~~~~~~~~~~~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:120:27: note: in expansion of macro 'pb'
  120 |                         s.pb('Y');
      |                           ^~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:123:27: note: in expansion of macro 'pb'
  123 |                         s.pb('B');
      |                           ^~
combo.cpp:129:28: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
  129 |             while(s.size() < N){
      |                   ~~~~~~~~~^~~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:131:22: note: in expansion of macro 'pb'
  131 |                   s1.pb('B');
      |                      ^~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:132:22: note: in expansion of macro 'pb'
  132 |                   s1.pb('X');
      |                      ^~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:134:22: note: in expansion of macro 'pb'
  134 |                   s1.pb('B');
      |                      ^~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:135:22: note: in expansion of macro 'pb'
  135 |                   s1.pb('A');
      |                      ^~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:137:22: note: in expansion of macro 'pb'
  137 |                   s1.pb('A');
      |                      ^~
combo.cpp:138:38: error: expected primary-expression before 's1'
  138 |                   cur = press(string s1);
      |                                      ^~
combo.cpp:139:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  139 |                   if(cur == s.size()){
      |                      ~~~~^~~~~~~~~~~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:140:27: note: in expansion of macro 'pb'
  140 |                         s.pb('X');
      |                           ^~
combo.cpp:143:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  143 |                   if(cur == s.size() + 1){
      |                      ~~~~^~~~~~~~~~~~~~~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:144:27: note: in expansion of macro 'pb'
  144 |                         s.pb('A');
      |                           ^~
combo.cpp:7:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back'
    7 | #define pb emplace_back
      |            ^~~~~~~~~~~~
combo.cpp:147:27: note: in expansion of macro 'pb'
  147 |                         s.pb('B');
      |                           ^~
combo.cpp:20:27: warning: control reaches end of non-void function [-Wreturn-type]
   20 |       string s = "", s1 = "AB";
      |                           ^~~~