Submission #211520

#TimeUsernameProblemLanguageResultExecution timeMemory
211520Harry464Combo (IOI18_combo)C++14
5 / 100
1 ms200 KiB
#include <iostream> #include <string> #include "combo.h" using namespace std; string guess_sequence(int N) { char slovo[4]={'A','B','X','Y'}; int prvoSlovo, odgovor; string s; if(press("AB")) { if(press("A")) prvoSlovo=0; else prvoSlovo=1; } else { if(press("X")) prvoSlovo=2; else prvoSlovo=3; } s+=slovo[prvoSlovo]; for(int i=2;i<N;i++) { odgovor=press(s + slovo[(prvoSlovo+1)%4] + slovo[(prvoSlovo+1)%4] + s + slovo[(prvoSlovo+1)%4] + slovo[(prvoSlovo+2)%4] + s + slovo[(prvoSlovo+1)%4] + slovo[(prvoSlovo+3)%4] + s + slovo[(prvoSlovo+2)%4]); if(odgovor==s.size()) s+=slovo[(prvoSlovo+3)%4]; else if(odgovor==s.size()+1) s+=slovo[(prvoSlovo+2)%4]; else s+=slovo[(prvoSlovo+1)%4]; } if(press(s+"A"+s+"B")>s.size()) { if(press(s+"A")>s.size()) s+="A"; else s+="B"; } else { if(press(s+"X")>s.size()) s+="X"; else s+="Y"; } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:32:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     if(odgovor==s.size()) s+=slovo[(prvoSlovo+3)%4];
      |        ~~~~~~~^~~~~~~~~~
combo.cpp:33:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     else if(odgovor==s.size()+1) s+=slovo[(prvoSlovo+2)%4];
      |             ~~~~~~~^~~~~~~~~~~~
combo.cpp:37:24: 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+"A"+s+"B")>s.size())
      |      ~~~~~~~~~~~~~~~~~~^~~~~~~~~
combo.cpp:39:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     if(press(s+"A")>s.size()) s+="A";
      |        ~~~~~~~~~~~~^~~~~~~~~
combo.cpp:44:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |     if(press(s+"X")>s.size()) s+="X";
      |        ~~~~~~~~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...