Submission #873510

#TimeUsernameProblemLanguageResultExecution timeMemory
873510velislavgarkovCombo (IOI18_combo)C++14
100 / 100
11 ms1832 KiB
#include "combo.h" #include <iostream> using namespace std; string guess_sequence(int n) { string ans, s; if (press("AB")) { if (press("A")) { ans+='A'; s="BXY"; } else { ans+='B'; s="AXY"; } } else { if (press("X")) { ans+='X'; s="ABY"; } else { ans+='Y'; s="ABX"; } } if (n==1) return ans; for (int i=1;i<n-1;i++) { string q=ans+s[0]+s[0]+ans+s[0]+s[1]+ans+s[0]+s[2]+ans+s[1]; int que=press(q); if (que==ans.size()+2) ans+=s[0]; else if (que==ans.size()+1) ans+=s[1]; else ans+=s[2]; } if (press(ans+s[0])==ans.size()+1) ans+=s[0]; else if (press(ans+s[1])==ans.size()+1) ans+=s[1]; else ans+=s[2]; return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:27:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |         if (que==ans.size()+2) ans+=s[0];
      |             ~~~^~~~~~~~~~~~~~
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 |         else if (que==ans.size()+1) ans+=s[1];
      |                  ~~~^~~~~~~~~~~~~~
combo.cpp:31:24: 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(ans+s[0])==ans.size()+1) ans+=s[0];
      |         ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
combo.cpp:32:29: 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(ans+s[1])==ans.size()+1) ans+=s[1];
      |              ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...