Submission #217799

#TimeUsernameProblemLanguageResultExecution timeMemory
217799kkm0476Combo (IOI18_combo)C++11
5 / 100
1 ms328 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"; } while (S.size() < N - 1) { int l; switch (S[0]) { case 'A': l = press(S + "BB" + S + "BX" + S + "BY" + S + "X"); if (l == S.size() + 2) S += "B"; else if (l == S.size() + 1) S += "X"; else S += "Y"; break; case 'B': l = press(S + "AA" + S + "AX" + S + "AY" + S + "X"); if (l == S.size() + 2) S += "A"; else if (l == S.size() + 1) S += "X"; else S += "Y"; break; case 'X': l = press(S + "AA" + S + "AB" + S + "AY" + S + "B"); if (l == S.size() + 2) S += "A"; else if (l == S.size() + 1) S += "B"; else S += "Y"; break; case 'Y': l = press(S + "AA" + S + "AB" + S + "AX" + S + "B"); if (l == S.size() + 2) S += "A"; else if (l == S.size() + 1) S += "B"; else S += "X"; break; } } if (press(S + "A" + S + "B") == N) { if (press(S + "A") == N) S += "A"; else S += "B"; } else { if (press(S + "X") == N) S += "X"; else S += "Y"; } return S; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:23:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |     while (S.size() < N - 1)
      |            ~~~~~~~~~^~~~~~~
combo.cpp:30:19: 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 (l == S.size() + 2)
      |                 ~~^~~~~~~~~~~~~~~
combo.cpp:32:24: 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 (l == S.size() + 1)
      |                      ~~^~~~~~~~~~~~~~~
combo.cpp:39:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |             if (l == S.size() + 2)
      |                 ~~^~~~~~~~~~~~~~~
combo.cpp:41:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |             else if (l == S.size() + 1)
      |                      ~~^~~~~~~~~~~~~~~
combo.cpp:48:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |             if (l == S.size() + 2)
      |                 ~~^~~~~~~~~~~~~~~
combo.cpp:50:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |             else if (l == S.size() + 1)
      |                      ~~^~~~~~~~~~~~~~~
combo.cpp:57:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |             if (l == S.size() + 2)
      |                 ~~^~~~~~~~~~~~~~~
combo.cpp:59:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |             else if (l == S.size() + 1)
      |                      ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...