Submission #759187

#TimeUsernameProblemLanguageResultExecution timeMemory
759187ivazivaCombo (IOI18_combo)C++14
94 / 100
23 ms636 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; long long n; string guess_sequence(int N) { n=N; if (n<=3) { ///test1 string s; char pocetno_slovo=' '; if (press("X")==1) pocetno_slovo='X'; else if (press("Y")==1) pocetno_slovo='Y'; else if (press("A")==1) pocetno_slovo='A'; else pocetno_slovo='B'; s.push_back(pocetno_slovo); for (long long i=2;i<=n;i++) { if (pocetno_slovo=='X') { if (press(s+'Y')==s.size()+1) s.push_back('Y'); else if (press(s+'A')==s.size()+1) s.push_back('A'); else s.push_back('B'); } if (pocetno_slovo=='Y') { if (press(s+'X')==s.size()+1) s.push_back('X'); else if (press(s+'A')==s.size()+1) s.push_back('A'); else s.push_back('B'); } if (pocetno_slovo=='A') { if (press(s+'Y')==s.size()+1) s.push_back('Y'); else if (press(s+'X')==s.size()+1) s.push_back('X'); else s.push_back('B'); } if (pocetno_slovo=='B') { if (press(s+'Y')==s.size()+1) s.push_back('Y'); else if (press(s+'A')==s.size()+1) s.push_back('A'); else s.push_back('X'); } } //cout<<s<<endl; return s; } else { string s; char pocetno_slovo=' '; if (press("X")==1) pocetno_slovo='X'; else if (press("Y")==1) pocetno_slovo='Y'; else if (press("A")==1) pocetno_slovo='A'; else pocetno_slovo='B'; s.push_back(pocetno_slovo); for (long long i=2;i<=n-2;i++) { if (pocetno_slovo=='X') { long long rez=press(s+'Y'+s+"AY"+s+"AA"+s+"AB"); if (rez==s.size()) s.push_back('B'); else if (rez==s.size()+1) s.push_back('Y'); else s.push_back('A'); } if (pocetno_slovo=='Y') { long long rez=press(s+'X'+s+"AX"+s+"AA"+s+"AB"); if (rez==s.size()) s.push_back('B'); else if (rez==s.size()+1) s.push_back('X'); else s.push_back('A'); } if (pocetno_slovo=='A') { long long rez=press(s+'X'+s+"YX"+s+"YY"+s+"YB"); if (rez==s.size()) s.push_back('B'); else if (rez==s.size()+1) s.push_back('X'); else s.push_back('Y'); } if (pocetno_slovo=='B') { long long rez=press(s+'X'+s+"YX"+s+"YY"+s+"YA"); if (rez==s.size()) s.push_back('A'); else if (rez==s.size()+1) s.push_back('X'); else s.push_back('Y'); } } for (long long i=1;i<=2;i++) { if (pocetno_slovo=='X') { if (press(s+'Y')==s.size()+1) s.push_back('Y'); else if (press(s+'A')==s.size()+1) s.push_back('A'); else s.push_back('B'); } if (pocetno_slovo=='Y') { if (press(s+'X')==s.size()+1) s.push_back('X'); else if (press(s+'A')==s.size()+1) s.push_back('A'); else s.push_back('B'); } if (pocetno_slovo=='A') { if (press(s+'Y')==s.size()+1) s.push_back('Y'); else if (press(s+'X')==s.size()+1) s.push_back('X'); else s.push_back('B'); } if (pocetno_slovo=='B') { if (press(s+'Y')==s.size()+1) s.push_back('Y'); else if (press(s+'A')==s.size()+1) s.push_back('A'); else s.push_back('X'); } } //cout<<s<<endl; return s; } }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:25:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |                 if (press(s+'Y')==s.size()+1) s.push_back('Y');
      |                     ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:26:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |                 else if (press(s+'A')==s.size()+1) s.push_back('A');
      |                          ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:31:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |                 if (press(s+'X')==s.size()+1) s.push_back('X');
      |                     ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:32:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |                 else if (press(s+'A')==s.size()+1) s.push_back('A');
      |                          ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:37:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |                 if (press(s+'Y')==s.size()+1) s.push_back('Y');
      |                     ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:38:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |                 else if (press(s+'X')==s.size()+1) s.push_back('X');
      |                          ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:43:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |                 if (press(s+'Y')==s.size()+1) s.push_back('Y');
      |                     ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:44:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |                 else if (press(s+'A')==s.size()+1) s.push_back('A');
      |                          ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:65:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |                 if (rez==s.size()) s.push_back('B');
      |                     ~~~^~~~~~~~~~
combo.cpp:66:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |                 else if (rez==s.size()+1) s.push_back('Y');
      |                          ~~~^~~~~~~~~~~~
combo.cpp:72:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   72 |                 if (rez==s.size()) s.push_back('B');
      |                     ~~~^~~~~~~~~~
combo.cpp:73:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |                 else if (rez==s.size()+1) s.push_back('X');
      |                          ~~~^~~~~~~~~~~~
combo.cpp:79:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   79 |                 if (rez==s.size()) s.push_back('B');
      |                     ~~~^~~~~~~~~~
combo.cpp:80:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   80 |                 else if (rez==s.size()+1) s.push_back('X');
      |                          ~~~^~~~~~~~~~~~
combo.cpp:86:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   86 |                 if (rez==s.size()) s.push_back('A');
      |                     ~~~^~~~~~~~~~
combo.cpp:87:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   87 |                 else if (rez==s.size()+1) s.push_back('X');
      |                          ~~~^~~~~~~~~~~~
combo.cpp:95:33: 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(s+'Y')==s.size()+1) s.push_back('Y');
      |                     ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:96:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   96 |                 else if (press(s+'A')==s.size()+1) s.push_back('A');
      |                          ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:101:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  101 |                 if (press(s+'X')==s.size()+1) s.push_back('X');
      |                     ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:102:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  102 |                 else if (press(s+'A')==s.size()+1) s.push_back('A');
      |                          ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:107:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  107 |                 if (press(s+'Y')==s.size()+1) s.push_back('Y');
      |                     ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:108:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  108 |                 else if (press(s+'X')==s.size()+1) s.push_back('X');
      |                          ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:113:33: 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(s+'Y')==s.size()+1) s.push_back('Y');
      |                     ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:114:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  114 |                 else if (press(s+'A')==s.size()+1) s.push_back('A');
      |                          ~~~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...