Submission #1008383

#TimeUsernameProblemLanguageResultExecution timeMemory
1008383HappyCapybaraCombo (IOI18_combo)C++17
100 / 100
27 ms1932 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string guess_sequence(int N){ string s; if (press("AB")){ if (press("A")) s = "A"; else s = "B"; } else { if (press("X")) s = "X"; else s = "Y"; } if (N == 1) return s; vector<string> v; for (string x : {"A", "B", "X", "Y"}) if (s != x) v.push_back(x); while (s.size() < N-1){ string p; p += s; p += v[0]; for (int i=0; i<3; i++){ p += s; p += v[1]; p += v[i]; } int res = press(p); if (res == s.size()+1) s += v[0]; else if (res == s.size()+2) s += v[1]; else s += v[2]; } if (press(s+v[0]) == N) return s+v[0]; if (press(s+v[1]) == N) return s+v[1]; return s+v[2]; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:18:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   18 |     while (s.size() < N-1){
      |            ~~~~~~~~~^~~~~
combo.cpp:28:17: 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 (res == s.size()+1) s += v[0];
      |             ~~~~^~~~~~~~~~~~~
combo.cpp:29:22: 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 (res == s.size()+2) s += v[1];
      |                  ~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...