Submission #124975

#TimeUsernameProblemLanguageResultExecution timeMemory
124975teomrnCombo (IOI18_combo)C++14
100 / 100
45 ms608 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string get_begin() { if (press("AB") >= 1) { if (press("A")) return "ABXY"; return "BAXY"; } if (press("X")) return "XABY"; return "YABX"; } string guess_sequence(int N) { string order = get_begin(); string S = order.substr(0, 1); string oth1 = order.substr(1, 1); string oth2 = order.substr(2, 1); string oth3 = order.substr(3, 1); while (S.size() + 2 <= N) { /// mai pot adauga 2 chestii string query = S + oth1 + oth1 + S + oth1 + oth2 + S + oth1 + oth3 + S + oth2; assert(S.size() + 2 <= N); int ans = press(query); if (ans == S.size() + 2) S += oth1; else if (ans == S.size() + 1) S += oth2; else S += oth3; } if (S.size() != N) { if (press(S + oth1 + S + oth2) == N) { if (press(S + oth1) == N) S += oth1; else S += oth2; } else S += oth3; } return S; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:24:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |  while (S.size() + 2 <= N) {
      |         ~~~~~~~~~~~~~^~~~
In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from combo.cpp:2:
combo.cpp:27:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   27 |   assert(S.size() + 2 <= N);
      |          ~~~~~~~~~~~~~^~~~
combo.cpp:30:11: 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 (ans == S.size() + 2)
      |       ~~~~^~~~~~~~~~~~~~~
combo.cpp:32:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |   else if (ans == S.size() + 1)
      |            ~~~~^~~~~~~~~~~~~~~
combo.cpp:38:15: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   38 |  if (S.size() != N) {
      |      ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...