제출 #738993

#제출 시각아이디문제언어결과실행 시간메모리
738993raul2008487콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include "combo.h" #include<bits/stdc++.h> #define pb push_back std::string guess_sequence(int N) { std::string s=""; int cc=1,st; int cs1=press("AB"),cs2=press("AX"); std::vector<string> vec; if(cs1==2){ s+="AB"; vec.pb('B'); vec.pb('X'); vec.pb('Y'); } else if(cs2==2){ s+="AX"; vec.pb('B'); vec.pb('X'); vec.pb('Y'); } else if(cs1==1 && cs2==1){ s+="AY"; vec.pb('B'); vec.pb('X'); vec.pb('Y'); } else if(cs1==1){ s+='B'; vec.pb('A'); vec.pb('X'); vec.pb('Y'); } else if(cs2==1){ s+='X'; vec.pb('A'); vec.pb('B'); vec.pb('Y'); } else{ s+='Y'; vec.pb('B'); vec.pb('X'); vec.pb('A'); } st=s.size(); if(st==N){ return s; } for(int i=st;i<n-1;i++){ int query=press(s+v[0]+s+v[1]+v[1]+s+v[1]+v[2]); if(query==(i+1)){ s+=v[0]; } else if(query==(i+2)){ s+=v[1]; } else{ s+=v[2]; } } if(press(s+v[0])==N){ return s+v[0]; } else if(press(s+v[1])==N){ return s+v[1]; } return s+v[2]; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:8:17: error: 'string' was not declared in this scope
    8 |     std::vector<string> vec;
      |                 ^~~~~~
combo.cpp:8:17: note: suggested alternatives:
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'
   79 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/string:67:11: note:   'std::pmr::string'
   67 |     using string    = basic_string<char>;
      |           ^~~~~~
combo.cpp:8:23: error: template argument 1 is invalid
    8 |     std::vector<string> vec;
      |                       ^
combo.cpp:8:23: error: template argument 2 is invalid
combo.cpp:3:12: error: request for member 'push_back' in 'vec', which is of non-class type 'int'
    3 | #define pb push_back
      |            ^~~~~~~~~
combo.cpp:11:13: note: in expansion of macro 'pb'
   11 |         vec.pb('B');
      |             ^~
combo.cpp:3:12: error: request for member 'push_back' in 'vec', which is of non-class type 'int'
    3 | #define pb push_back
      |            ^~~~~~~~~
combo.cpp:12:13: note: in expansion of macro 'pb'
   12 |         vec.pb('X');
      |             ^~
combo.cpp:3:12: error: request for member 'push_back' in 'vec', which is of non-class type 'int'
    3 | #define pb push_back
      |            ^~~~~~~~~
combo.cpp:13:13: note: in expansion of macro 'pb'
   13 |         vec.pb('Y');
      |             ^~
combo.cpp:3:12: error: request for member 'push_back' in 'vec', which is of non-class type 'int'
    3 | #define pb push_back
      |            ^~~~~~~~~
combo.cpp:17:13: note: in expansion of macro 'pb'
   17 |         vec.pb('B');
      |             ^~
combo.cpp:3:12: error: request for member 'push_back' in 'vec', which is of non-class type 'int'
    3 | #define pb push_back
      |            ^~~~~~~~~
combo.cpp:18:13: note: in expansion of macro 'pb'
   18 |         vec.pb('X');
      |             ^~
combo.cpp:3:12: error: request for member 'push_back' in 'vec', which is of non-class type 'int'
    3 | #define pb push_back
      |            ^~~~~~~~~
combo.cpp:19:13: note: in expansion of macro 'pb'
   19 |         vec.pb('Y');
      |             ^~
combo.cpp:3:12: error: request for member 'push_back' in 'vec', which is of non-class type 'int'
    3 | #define pb push_back
      |            ^~~~~~~~~
combo.cpp:23:13: note: in expansion of macro 'pb'
   23 |         vec.pb('B');
      |             ^~
combo.cpp:3:12: error: request for member 'push_back' in 'vec', which is of non-class type 'int'
    3 | #define pb push_back
      |            ^~~~~~~~~
combo.cpp:24:13: note: in expansion of macro 'pb'
   24 |         vec.pb('X');
      |             ^~
combo.cpp:3:12: error: request for member 'push_back' in 'vec', which is of non-class type 'int'
    3 | #define pb push_back
      |            ^~~~~~~~~
combo.cpp:25:13: note: in expansion of macro 'pb'
   25 |         vec.pb('Y');
      |             ^~
combo.cpp:3:12: error: request for member 'push_back' in 'vec', which is of non-class type 'int'
    3 | #define pb push_back
      |            ^~~~~~~~~
combo.cpp:29:13: note: in expansion of macro 'pb'
   29 |         vec.pb('A');
      |             ^~
combo.cpp:3:12: error: request for member 'push_back' in 'vec', which is of non-class type 'int'
    3 | #define pb push_back
      |            ^~~~~~~~~
combo.cpp:30:13: note: in expansion of macro 'pb'
   30 |         vec.pb('X');
      |             ^~
combo.cpp:3:12: error: request for member 'push_back' in 'vec', which is of non-class type 'int'
    3 | #define pb push_back
      |            ^~~~~~~~~
combo.cpp:31:13: note: in expansion of macro 'pb'
   31 |         vec.pb('Y');
      |             ^~
combo.cpp:3:12: error: request for member 'push_back' in 'vec', which is of non-class type 'int'
    3 | #define pb push_back
      |            ^~~~~~~~~
combo.cpp:35:13: note: in expansion of macro 'pb'
   35 |         vec.pb('A');
      |             ^~
combo.cpp:3:12: error: request for member 'push_back' in 'vec', which is of non-class type 'int'
    3 | #define pb push_back
      |            ^~~~~~~~~
combo.cpp:36:13: note: in expansion of macro 'pb'
   36 |         vec.pb('B');
      |             ^~
combo.cpp:3:12: error: request for member 'push_back' in 'vec', which is of non-class type 'int'
    3 | #define pb push_back
      |            ^~~~~~~~~
combo.cpp:37:13: note: in expansion of macro 'pb'
   37 |         vec.pb('Y');
      |             ^~
combo.cpp:3:12: error: request for member 'push_back' in 'vec', which is of non-class type 'int'
    3 | #define pb push_back
      |            ^~~~~~~~~
combo.cpp:41:13: note: in expansion of macro 'pb'
   41 |         vec.pb('B');
      |             ^~
combo.cpp:3:12: error: request for member 'push_back' in 'vec', which is of non-class type 'int'
    3 | #define pb push_back
      |            ^~~~~~~~~
combo.cpp:42:13: note: in expansion of macro 'pb'
   42 |         vec.pb('X');
      |             ^~
combo.cpp:3:12: error: request for member 'push_back' in 'vec', which is of non-class type 'int'
    3 | #define pb push_back
      |            ^~~~~~~~~
combo.cpp:43:13: note: in expansion of macro 'pb'
   43 |         vec.pb('A');
      |             ^~
combo.cpp:49:20: error: 'n' was not declared in this scope
   49 |     for(int i=st;i<n-1;i++){
      |                    ^
combo.cpp:50:27: error: 'v' was not declared in this scope
   50 |         int query=press(s+v[0]+s+v[1]+v[1]+s+v[1]+v[2]);
      |                           ^
combo.cpp:61:16: error: 'v' was not declared in this scope
   61 |     if(press(s+v[0])==N){
      |                ^
combo.cpp:67:14: error: 'v' was not declared in this scope
   67 |     return s+v[2];
      |              ^
combo.cpp:6:9: warning: unused variable 'cc' [-Wunused-variable]
    6 |     int cc=1,st;
      |         ^~