Submission #211229

#TimeUsernameProblemLanguageResultExecution timeMemory
211229grobarCombo (IOI18_combo)C++14
5 / 100
92 ms576 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; //A 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"); //X 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("YY"); v2.push_back("YA"); v2.push_back("YB"); //Y 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"); //B 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:69:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   69 |             if(ss.size()==n)
      |                ~~~~~~~~~^~~
combo.cpp:74:24: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   74 |         while(ss.size()<n)
      |               ~~~~~~~~~^~
combo.cpp:76: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]
   76 |             for(int i=0; i<v1.size(); i++)
      |                          ~^~~~~~~~~~
combo.cpp:79:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   79 |                 if(press(ss1)==ss1.size())
      |                    ~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:82:33: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   82 |                     if(ss.size()==n)
      |                        ~~~~~~~~~^~~
combo.cpp:107:21: 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:112:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  112 |     while(ss.size()!=n)
      |           ~~~~~~~~~^~~
combo.cpp:114: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]
  114 |         for(int i=0; i<v2.size(); i++)
      |                      ~^~~~~~~~~~
combo.cpp:117:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  117 |             if(press(ss1)==ss1.size())
      |                ~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:120:29: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  120 |                 if(ss.size()==n)
      |                    ~~~~~~~~~^~~
combo.cpp:145:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  145 |             if(ss.size()==n)
      |                ~~~~~~~~~^~~
combo.cpp:150:24: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  150 |         while(ss.size()!=n)
      |               ~~~~~~~~~^~~
combo.cpp:152: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]
  152 |             for(int i=0; i<v3.size(); i++)
      |                          ~^~~~~~~~~~
combo.cpp:155:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  155 |                 if(press(ss1)==ss1.size())
      |                    ~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:158:33: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  158 |                     if(ss.size()==n)
      |                        ~~~~~~~~~^~~
combo.cpp:183:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  183 |             if(ss.size()==n)
      |                ~~~~~~~~~^~~
combo.cpp:188:24: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  188 |         while(ss.size()!=n)
      |               ~~~~~~~~~^~~
combo.cpp:190: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]
  190 |             for(int i=0; i<v4.size(); i++)
      |                          ~^~~~~~~~~~
combo.cpp:193:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  193 |                 if(press(ss1)==ss1.size())
      |                    ~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:196:33: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  196 |                     if(ss.size()==n)
      |                        ~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...