Submission #577275

#TimeUsernameProblemLanguageResultExecution timeMemory
577275MrDebooCombo (IOI18_combo)C++17
100 / 100
30 ms620 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { string ans; if(press("AB")){ if(press("A"))ans+='A'; else ans+='B'; }else{ if(press("X"))ans+='X'; else ans+='Y'; } if(n==1)return ans; string v; if(ans=="A")v="BXY"; else if(ans=="B")v="AXY"; else if(ans=="X")v="ABY"; else v="ABX"; for(int i=2;i<n;i++){ string f; f+=ans+v[0]+v[0]; f+=ans+v[0]+v[1]; f+=ans+v[0]+v[2]; f+=ans+v[1]; int k=press(f); if(k==ans.size()+2)ans+=v[0]; else if(k==ans.size()+1)ans+=v[1]; else ans+=v[2]; } string GG=ans; GG+=v[0]; GG+=ans; GG+=v[1]; if(press(GG)==ans.size()+1){ if(press(ans+v[0])==ans.size()+1)ans+=v[0]; else ans+=v[1]; }else ans+=v[2]; return ans; }

Compilation message (stderr)

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