제출 #282010

#제출 시각아이디문제언어결과실행 시간메모리
282010ec1117콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h" using namespace std; #define pb push_back #define mp make_pair int x; string guess_sequence(int N){ string cur=""; if(press("AB")>0){ if(press("A")==1)cur="A"; else cur="B"; } else{ if(press("X")==1)cur="X"; else cur="Y"; } vector<char> vec{'A','B','X','Y'}; for(int i=0;i<4;i++){ if(vec[i]==cur[0]){ vec.erase(vec.begin()+i); break; } } while(cur.size()<N){ if(cur.size()==N-1){ if(press(cur+vec[0])==N){ return cur+vec[0]; } else if(press(cur+vec[1])==N){ return cur+vec[1]; } else{ return cur+vec[2]; } } else{ string tmp=cur+vec[0]+vec[0]+cur+vec[0]+vec[1]+cur+vec[0]+vec[2]+cur+vec[1]; x=press(tmp); if(x==cur.size()+2){ cur+=vec[0]; } else if(x==cur.size()+1){ cur+=vec[1]; } else{ cur+=vec[2]; } } } }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:8: error: 'press' was not declared in this scope
    9 |     if(press("AB")>0){
      |        ^~~~~
combo.cpp:24:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |     while(cur.size()<N){
      |           ~~~~~~~~~~^~
combo.cpp:25:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   25 |         if(cur.size()==N-1){
      |            ~~~~~~~~~~^~~~~
combo.cpp:26:16: error: 'press' was not declared in this scope
   26 |             if(press(cur+vec[0])==N){
      |                ^~~~~
combo.cpp:38:15: error: 'press' was not declared in this scope
   38 |             x=press(tmp);
      |               ^~~~~
combo.cpp:39:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |             if(x==cur.size()+2){
      |                ~^~~~~~~~~~~~~~
combo.cpp:42:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |             else if(x==cur.size()+1){
      |                     ~^~~~~~~~~~~~~~
combo.cpp:8:16: warning: control reaches end of non-void function [-Wreturn-type]
    8 |     string cur="";
      |                ^~