Submission #211222

#TimeUsernameProblemLanguageResultExecution timeMemory
211222grobarCombo (IOI18_combo)C++14
0 / 100
113 ms200 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; std::string guess_sequence(int n) { string ss=""; vector<string>v1; vector<string>v2; vector<string>v3; vector<string>v4; string ss1; v1.push_back("BB"); v1.push_back("BX"); v1.push_back("BY"); v1.push_back("XX"); v1.push_back("XY"); v1.push_back("XB"); v1.push_back("YY"); v1.push_back("YX"); v1.push_back("YB"); v2.push_back("AA"); v2.push_back("AB"); v2.push_back("AY"); v2.push_back("BY"); v2.push_back("BB"); v2.push_back("BA"); v2.push_back("XX"); v2.push_back("XA"); v2.push_back("XB"); v3.push_back("BB"); v3.push_back("BX"); v3.push_back("BA"); v3.push_back("XA"); v3.push_back("XX"); v3.push_back("XB"); v3.push_back("AA"); v3.push_back("AB"); v3.push_back("AX"); v4.push_back("AA"); v4.push_back("AX"); v4.push_back("AY"); v4.push_back("XA"); v4.push_back("XX"); v4.push_back("XY"); v4.push_back("YA"); v4.push_back("YY"); v4.push_back("YX"); if(press("A")==1) { ss=ss+"A"; if(n%2==0) { if(press("AB")==2) { ss=ss+"B"; } if(press("AX")==2) { ss=ss+"X"; } if(press("AY")==2) { ss=ss+"Y"; } if(ss.size()==n) { return ss; } } while(ss.size()<n) { for(int i=0; i<v1.size(); i++) { ss1=ss+v1[i]; if(press(ss1)==ss1.size()) { ss=ss+v1[i]; if(ss.size()==n) { break; } } } } } if(press("X")==1) ss=ss+"X"; if(n%2==0) { if(press("XB")==2) { ss=ss+"B"; } if(press("XA")==2) { ss=ss+"A"; } if(press("XY")==2) { ss=ss+"Y"; } if(ss.size()==n) { return ss; } } while(ss.size()!=n) { for(int i=0; i<v2.size(); i++) { ss1=ss+v2[i]; if(press(ss1)==ss1.size()) { ss=ss+v2[i]; if(ss.size()==n) { break; } } } } if(press("Y")==1) { ss=ss+"Y"; if(n%2==0) { if(press("YB")==2) { ss=ss+"B"; } if(press("YX")==2) { ss=ss+"X"; } if(press("YA")==2) { ss=ss+"A"; } if(ss.size()==n) { return ss; } } while(ss.size()!=n) { for(int i=0; i<v3.size(); i++) { ss1=ss+v3[i]; if(press(ss1)==ss1.size()) { ss=ss+v3[i]; if(ss.size()==n) { break; } } } } } if(press("B")==1) { ss=ss+"B"; if(n%2==0) { if(press("BA")==2) { ss=ss+"A"; } if(press("BX")==2) { ss=ss+"X"; } if(press("BY")==2) { ss=ss+"Y"; } if(ss.size()==n) { return ss; } } while(ss.size()!=n) { for(int i=0; i<v4.size(); i++) { ss1=ss+v4[i]; if(press(ss1)==ss1.size()) { ss=ss+v4[i]; if(ss.size()==n) { break; } } } } } return ss; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:65:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   65 |             if(ss.size()==n)
      |                ~~~~~~~~~^~~
combo.cpp:70:24: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   70 |         while(ss.size()<n)
      |               ~~~~~~~~~^~
combo.cpp:72:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   72 |             for(int i=0; i<v1.size(); i++)
      |                          ~^~~~~~~~~~
combo.cpp:75:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   75 |                 if(press(ss1)==ss1.size())
      |                    ~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:78:33: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   78 |                     if(ss.size()==n)
      |                        ~~~~~~~~~^~~
combo.cpp:102:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  102 |         if(ss.size()==n)
      |            ~~~~~~~~~^~~
combo.cpp:107:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  107 |     while(ss.size()!=n)
      |           ~~~~~~~~~^~~
combo.cpp:109:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  109 |         for(int i=0; i<v2.size(); i++)
      |                      ~^~~~~~~~~~
combo.cpp:112:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  112 |             if(press(ss1)==ss1.size())
      |                ~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:115:29: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  115 |                 if(ss.size()==n)
      |                    ~~~~~~~~~^~~
combo.cpp:139:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  139 |             if(ss.size()==n)
      |                ~~~~~~~~~^~~
combo.cpp:144:24: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  144 |         while(ss.size()!=n)
      |               ~~~~~~~~~^~~
combo.cpp:146:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  146 |             for(int i=0; i<v3.size(); i++)
      |                          ~^~~~~~~~~~
combo.cpp:149:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  149 |                 if(press(ss1)==ss1.size())
      |                    ~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:152:33: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  152 |                     if(ss.size()==n)
      |                        ~~~~~~~~~^~~
combo.cpp:177:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  177 |             if(ss.size()==n)
      |                ~~~~~~~~~^~~
combo.cpp:182:24: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  182 |         while(ss.size()!=n)
      |               ~~~~~~~~~^~~
combo.cpp:184:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  184 |             for(int i=0; i<v4.size(); i++)
      |                          ~^~~~~~~~~~
combo.cpp:187:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  187 |                 if(press(ss1)==ss1.size())
      |                    ~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:190:33: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  190 |                     if(ss.size()==n)
      |                        ~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...