제출 #210599

#제출 시각아이디문제언어결과실행 시간메모리
210599grobar콤보 (IOI18_combo)C++14
10 / 100
96 ms696 KiB
#include "combo.h" using namespace std; std::string guess_sequence(int n) { string ss=""; int a1=press("A"); if(a1==1) { ss=ss+"A"; for(int i=1;i<n;i++) { string ss1; ss1=ss+"B"; if(press(ss1)==ss1.size()) { ss=ss+"B"; if(ss.size()==n) { return ss; break; } } string ss2=ss+"X"; if(press(ss2)==ss2.size()) { ss=ss+"X"; if(ss.size()==n) { return ss; break; } } string ss3=ss+"Y"; if(press(ss3)==ss3.size()) { ss=ss+"Y"; if(ss.size()==n) { return ss; break; } } } } int a2=press("B"); if(a2==1) { ss=ss+"B"; //ss4=ss4+"B"; for(int i=1;i<n;i++) { string ss4=ss+"A"; if(press(ss4)==ss4.size()) { ss=ss+"A"; if(ss.size()==n) { break; } }string ss5=ss+"X"; if(press(ss5)==ss5.size()) { ss=ss+"X"; if(ss.size()==n) { break; } } string ss6=ss+"Y"; if(press(ss6)==ss6.size()) { ss=ss+"Y"; if(ss.size()==n) { break; } } } } int a3=press("X"); if(a3==1) { ss=ss+"X"; for(int i=1;i<n;i++) { string ss7=ss+"A"; if(press(ss7)==ss7.size()) { ss=ss+"A"; if(ss.size()==n) { break; } } string ss8=ss+"B"; if(press(ss8)==ss8.size()) { ss=ss+"B"; if(ss.size()==n) { break; } } string ss9=ss+"Y"; if(press(ss9)==ss9.size()) { ss=ss+"Y"; if(ss.size()==n) { break; } } } } int a4=press("Y"); if(a4==1) { ss=ss+"Y"; for(int i=1;i<n;i++) { string ss10=ss+"A"; if(press(ss10)==ss10.size()) { ss=ss+"A"; if(ss.size()==n) { break; } } string ss11=ss+"X"; if(press(ss11)==ss11.size()) { ss=ss+"X"; if(ss.size()==n) { break; } } string ss12=ss+"B"; if(press(ss12)==ss12.size()) { ss=ss+"B"; if(ss.size()==n) { break; } } } } return ss; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:13:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |             if(press(ss1)==ss1.size())
      |                ~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:16:29: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |                 if(ss.size()==n)
      |                    ~~~~~~~~~^~~
combo.cpp:23:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |             if(press(ss2)==ss2.size())
      |                ~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:26:29: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   26 |                 if(ss.size()==n)
      |                    ~~~~~~~~~^~~
combo.cpp:33:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |             if(press(ss3)==ss3.size())
      |                ~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:36:29: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |                 if(ss.size()==n)
      |                    ~~~~~~~~~^~~
combo.cpp:52:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |             if(press(ss4)==ss4.size())
      |                ~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:55:29: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   55 |                 if(ss.size()==n)
      |                    ~~~~~~~~~^~~
combo.cpp:60:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |             if(press(ss5)==ss5.size())
      |                ~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:63:29: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   63 |                 if(ss.size()==n)
      |                    ~~~~~~~~~^~~
combo.cpp:69:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   69 |             if(press(ss6)==ss6.size())
      |                ~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:72:29: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   72 |                 if(ss.size()==n)
      |                    ~~~~~~~~~^~~
combo.cpp:86:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   86 |             if(press(ss7)==ss7.size())
      |                ~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:89:29: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   89 |                 if(ss.size()==n)
      |                    ~~~~~~~~~^~~
combo.cpp:95:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   95 |             if(press(ss8)==ss8.size())
      |                ~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:98:29: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   98 |                 if(ss.size()==n)
      |                    ~~~~~~~~~^~~
combo.cpp:104:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  104 |             if(press(ss9)==ss9.size())
      |                ~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:107:29: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  107 |                 if(ss.size()==n)
      |                    ~~~~~~~~~^~~
combo.cpp:121:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  121 |             if(press(ss10)==ss10.size())
      |                ~~~~~~~~~~~^~~~~~~~~~~~~
combo.cpp:124:29: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  124 |                 if(ss.size()==n)
      |                    ~~~~~~~~~^~~
combo.cpp:130:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  130 |             if(press(ss11)==ss11.size())
      |                ~~~~~~~~~~~^~~~~~~~~~~~~
combo.cpp:133:29: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  133 |                 if(ss.size()==n)
      |                    ~~~~~~~~~^~~
combo.cpp:139:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  139 |             if(press(ss12)==ss12.size())
      |                ~~~~~~~~~~~^~~~~~~~~~~~~
combo.cpp:142:29: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  142 |                 if(ss.size()==n)
      |                    ~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...