제출 #160278

#제출 시각아이디문제언어결과실행 시간메모리
160278MarcoMendoza1콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; string r="",aux; char arr[4]; string guess_sequence(int n){ if(press("AB")){ arr[1]='X'; arr[3]='Y'; if(press("A")){ arr[2]='B'; r="A"; }else{ arr[2]='A'; r="B"; } }else{ arr[1]='A'; arr[2]='B'; if(press("X")){ arr[3]='Y'; r="X"; }else{ arr[3]='X'; r="Y"; } } int ax; while(r.size()<(n-1)){ aux=r+arr[2]+r+arr[1]+arr[1]+r+arr[1]+arr[2]+r+arr[1]+arr[3]; ax=press(aux); if(ax==r.size()){ r=r+arr[3]; }else if(ax==(r.size()+1)){ r=r+arr[2]; }else{ r=r+arr[1]; } } if(press(r+arr[1]+r+arr[2])==n){ if(press(r+arr[1])==n){ return r+arr[1]; }else{ return r+arr[2]; } }else{ return r+arr[3]; } }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:8:6: error: 'press' was not declared in this scope
    8 |   if(press("AB")){
      |      ^~~~~
combo.cpp:36:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |     while(r.size()<(n-1)){
      |           ~~~~~~~~^~~~~~
combo.cpp:38:12: error: 'press' was not declared in this scope
   38 |         ax=press(aux);
      |            ^~~~~
combo.cpp:39:14: 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(ax==r.size()){
      |            ~~^~~~~~~~~~
combo.cpp:42:20: 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(ax==(r.size()+1)){
      |                  ~~^~~~~~~~~~~~~~
combo.cpp:52:8: error: 'press' was not declared in this scope
   52 |     if(press(r+arr[1]+r+arr[2])==n){
      |        ^~~~~
combo.cpp:66:1: warning: control reaches end of non-void function [-Wreturn-type]
   66 | }
      | ^