Submission #211227

#TimeUsernameProblemLanguageResultExecution timeMemory
211227grobarCombo (IOI18_combo)C++14
0 / 100
67 ms452 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:103:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  103 |         if(ss.size()==n)
      |            ~~~~~~~~~^~~
combo.cpp:108:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  108 |     while(ss.size()!=n)
      |           ~~~~~~~~~^~~
combo.cpp:110: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]
  110 |         for(int i=0; i<v2.size(); i++)
      |                      ~^~~~~~~~~~
combo.cpp:113:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  113 |             if(press(ss1)==ss1.size())
      |                ~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:116:29: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  116 |                 if(ss.size()==n)
      |                    ~~~~~~~~~^~~
combo.cpp:141:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  141 |             if(ss.size()==n)
      |                ~~~~~~~~~^~~
combo.cpp:146:24: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  146 |         while(ss.size()!=n)
      |               ~~~~~~~~~^~~
combo.cpp:148: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]
  148 |             for(int i=0; i<v3.size(); i++)
      |                          ~^~~~~~~~~~
combo.cpp:151:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  151 |                 if(press(ss1)==ss1.size())
      |                    ~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:154:33: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  154 |                     if(ss.size()==n)
      |                        ~~~~~~~~~^~~
combo.cpp:179:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  179 |             if(ss.size()==n)
      |                ~~~~~~~~~^~~
combo.cpp:184:24: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  184 |         while(ss.size()!=n)
      |               ~~~~~~~~~^~~
combo.cpp:186: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]
  186 |             for(int i=0; i<v4.size(); i++)
      |                          ~^~~~~~~~~~
combo.cpp:189:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  189 |                 if(press(ss1)==ss1.size())
      |                    ~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:192:33: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  192 |                     if(ss.size()==n)
      |                        ~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...