Submission #1061564

#TimeUsernameProblemLanguageResultExecution timeMemory
1061564PetrixCombo (IOI18_combo)C++17
5 / 100
1 ms344 KiB
#include "combo.h" #include<string> #include<vector> using namespace std; string guess_sequence(int n){ vector<char> v; int i,aux1; string s,aux; if(press("AB")){ if(press("A")) s='A'; else s='B'; }else{ if(press("X")) s='X'; else s='Y'; } if(s[0]!='X') v.push_back('X'); if(s[0]!='Y') v.push_back('Y'); if(s[0]!='A') v.push_back('A'); if(s[0]!='B') v.push_back('B'); for(i=2;i<=n-1;i++){ aux=s+v[0]+s+v[1]+v[0]+s+v[1]+v[1]+s+v[1]+v[2]; aux1=press(aux); if(aux1==i-1) s+=v[2]; else if(aux1==i) s+=v[0]; else s+=v[1]; } if(press(s+v[0])==s.size()+1) s+=v[0]; else if(press(s+v[1])==s.size()+1) s+=v[1]; else s+=v[2]; return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:28:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     if(press(s+v[0])==s.size()+1) s+=v[0];
      |        ~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:29:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     else if(press(s+v[1])==s.size()+1) s+=v[1];
      |             ~~~~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...