Submission #369148

#TimeUsernameProblemLanguageResultExecution timeMemory
369148wind_reaperCombo (IOI18_combo)C++17
97 / 100
55 ms560 KiB
#include <combo.h> #include <bits/stdc++.h> using namespace std; string guess_sequence(int N){ string ans; vector<string> s = {"A", "B", "X", "Y"}; bool f = false; for(int i = 0; i < 3 && !f; i++){ if(press(s[i]) == 1){ ans += s[i]; s.erase(s.begin() + i); f = true; } } if(!f){ ans += 'Y'; s.erase(s.begin() + 3); } if(N == 1) return ans; for(int i = 1; i < N-1; i++){ string query = ans + s[0] + ans + s[1] + s[0] + ans + s[1] + s[1] + ans + s[1] + s[2]; int r = press(query); if(r == ans.size() + 1){ ans += s[0]; continue; } if(r == ans.size() + 2){ ans += s[1]; continue; } if(r == ans.size()){ ans += s[2]; continue; } } string query = ans + s[0] + ans + s[1]; if(press(query) == N){ query = ans + s[0]; if(press(query) == N) return query; query = ans + s[1]; return query; } return (ans + s[2]); }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:26:8: 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(r == ans.size() + 1){
      |      ~~^~~~~~~~~~~~~~~~~
combo.cpp:30:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |   if(r == ans.size() + 2){
      |      ~~^~~~~~~~~~~~~~~~~
combo.cpp:34:8: 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(r == ans.size()){
      |      ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...