Submission #756380

#TimeUsernameProblemLanguageResultExecution timeMemory
756380anaduguleanuCombo (IOI18_combo)C++14
100 / 100
36 ms620 KiB
#include <iostream> #include <cstring> #include "combo.h" using namespace std; string guess_sequence(int N) { string s, rest; if (press("AB") > 0) { if (press("A") == 1) { s = "A"; rest = "BXY"; } else { s = "B"; rest = "AXY"; } } else { if (press("X") == 1) { s = "X"; rest = "ABY"; } else { s = "Y"; rest = "ABX"; } } if (N == 1) return s; while (s.size() < N - 1) { int length = press(s + rest[0] + s + rest[1] + rest[0] + s + rest[1] + rest[1] + s + rest[1] + rest[2]); if (s.size() == length - 1) s = s + rest[0]; else if (s.size() == length - 2) s = s + rest[1]; else s = s + rest[2]; } if (s.size() != press(s + rest[0])) s = s + rest[0]; else if (s.size() != press(s + rest[1])) s = s + rest[1]; else s = s + rest[2]; return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:36:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |     while (s.size() < N - 1)
      |            ~~~~~~~~~^~~~~~~
combo.cpp:39:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   39 |         if (s.size() == length - 1)
      |             ~~~~~~~~~^~~~~~~~~~~~~
combo.cpp:42:26: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   42 |             if (s.size() == length - 2)
      |                 ~~~~~~~~~^~~~~~~~~~~~~
combo.cpp:47:18: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   47 |     if (s.size() != press(s + rest[0]))
      |         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
combo.cpp:50:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   50 |         if (s.size() != press(s + rest[1]))
      |             ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...