Submission #413796

#TimeUsernameProblemLanguageResultExecution timeMemory
413796illyakrCombo (IOI18_combo)C++14
94 / 100
49 ms556 KiB
#include "combo.h" using namespace std; // A B X Y string guess_sequence(int N) { string ans = ""; if (press("A") == 1)ans = "A"; else if (press("B") == 1)ans = "B"; else if (press("X") == 1)ans = "X"; else ans = "Y"; if (N == 1)return ans; while (ans.size() + 1 < N) { if (ans[0] == 'A') { int c = press(ans + "B" + ans + "XB" + ans + "XX" + ans + "XY"); if (c == ans.size())ans.push_back('Y'); else if (c == ans.size() + 1)ans.push_back('B'); else if (c == ans.size() + 2)ans.push_back('X'); continue; } if (ans[0] == 'B') { int c = press(ans + "A" + ans + "XA" + ans + "XX" + ans + "XY"); if (c == ans.size())ans.push_back('Y'); else if (c == ans.size() + 1)ans.push_back('A'); else if (c == ans.size() + 2)ans.push_back('X'); continue; } if (ans[0] == 'X') { int c = press(ans + "B" + ans + "AB" + ans + "AA" + ans + "AY"); if (c == ans.size())ans.push_back('Y'); else if (c == ans.size() + 1)ans.push_back('B'); else if (c == ans.size() + 2)ans.push_back('A'); continue; } if (ans[0] == 'Y') { int c = press(ans + "B" + ans + "AB" + ans + "AA" + ans + "AX"); if (c == ans.size())ans.push_back('X'); else if (c == ans.size() + 1)ans.push_back('B'); else if (c == ans.size() + 2)ans.push_back('A'); continue; } } if (press(ans + "A") == ans.size() + 1)ans.push_back('A'); else if (press(ans + "B") == ans.size() + 1)ans.push_back('B'); else if (press(ans + "X") == ans.size() + 1)ans.push_back('X'); else ans.push_back('Y'); return ans; } /** */

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:14:27: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   14 |     while (ans.size() + 1 < N) {
      |            ~~~~~~~~~~~~~~~^~~
combo.cpp:17:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |             if (c == ans.size())ans.push_back('Y');
      |                 ~~^~~~~~~~~~~~~
combo.cpp:18:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |             else if (c == ans.size() + 1)ans.push_back('B');
      |                      ~~^~~~~~~~~~~~~~~~~
combo.cpp:19:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |             else if (c == ans.size() + 2)ans.push_back('X');
      |                      ~~^~~~~~~~~~~~~~~~~
combo.cpp:24:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |             if (c == ans.size())ans.push_back('Y');
      |                 ~~^~~~~~~~~~~~~
combo.cpp:25:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |             else if (c == ans.size() + 1)ans.push_back('A');
      |                      ~~^~~~~~~~~~~~~~~~~
combo.cpp:26:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |             else if (c == ans.size() + 2)ans.push_back('X');
      |                      ~~^~~~~~~~~~~~~~~~~
combo.cpp:31:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |             if (c == ans.size())ans.push_back('Y');
      |                 ~~^~~~~~~~~~~~~
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 (c == ans.size() + 1)ans.push_back('B');
      |                      ~~^~~~~~~~~~~~~~~~~
combo.cpp:33:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |             else if (c == ans.size() + 2)ans.push_back('A');
      |                      ~~^~~~~~~~~~~~~~~~~
combo.cpp:38:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |             if (c == ans.size())ans.push_back('X');
      |                 ~~^~~~~~~~~~~~~
combo.cpp:39:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |             else if (c == ans.size() + 1)ans.push_back('B');
      |                      ~~^~~~~~~~~~~~~~~~~
combo.cpp:40:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |             else if (c == ans.size() + 2)ans.push_back('A');
      |                      ~~^~~~~~~~~~~~~~~~~
combo.cpp:44:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |     if (press(ans + "A") == ans.size() + 1)ans.push_back('A');
      |         ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
combo.cpp:45:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |     else if (press(ans + "B") == ans.size() + 1)ans.push_back('B');
      |              ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
combo.cpp:46:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |     else if (press(ans + "X") == ans.size() + 1)ans.push_back('X');
      |              ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...