Submission #436398

#TimeUsernameProblemLanguageResultExecution timeMemory
436398stoyan_malininCombo (IOI18_combo)C++14
10 / 100
84 ms452 KiB
#include <algorithm> #include <iostream> #include <vector> #include <string> #include "combo.h" #ifdef __LOCAL #include "grader.cpp" #endif // __LOCAL using namespace std; char extend(string &ans) { vector <char> options = {'A', 'B', 'X', 'Y'}; if(ans.size()!=0) options.erase(find(options.begin(), options.end(), ans[0])); if(ans.size()==0) { for(char c: options) { if(press(ans+c)==ans.size()+1) return c; } } else { int res = press(ans+options[0]+ans+options[1]); if(res==ans.size()) return options[2]; res = press(ans+options[0]); if(res==ans.size()) return options[1]; return options[0]; } } string guess_sequence(int N) { string ans = ""; for(int i = 0;i<N;i++) ans += extend(ans); return ans; }

Compilation message (stderr)

combo.cpp: In function 'char extend(std::string&)':
combo.cpp:23:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |             if(press(ans+c)==ans.size()+1) return c;
      |                ~~~~~~~~~~~~^~~~~~~~~~~~~~
combo.cpp:29:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         if(res==ans.size()) return options[2];
      |            ~~~^~~~~~~~~~~~
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(res==ans.size()) return options[1];
      |            ~~~^~~~~~~~~~~~
combo.cpp:15:48: warning: control reaches end of non-void function [-Wreturn-type]
   15 |     vector <char> options = {'A', 'B', 'X', 'Y'};
      |                                                ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...