제출 #429436

#제출 시각아이디문제언어결과실행 시간메모리
429436illyakr콤보 (IOI18_combo)C++14
100 / 100
48 ms560 KiB
#include "combo.h" using namespace std; // A B X Y string guess_sequence(int N) { string ans = ""; if (press("AB") >= 1) { if (press("A") == 1)ans = "A"; else 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 + "B") == ans.size() + 1) { if (press(ans + "A") == ans.size() + 1)ans.push_back('A'); else ans.push_back('B'); } else { if (press(ans + "X") == ans.size() + 1)ans.push_back('X'); else ans.push_back('Y'); } return ans; } /** */

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:17:31: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   17 |         while (ans.size() + 1 < N) {
      |                ~~~~~~~~~~~~~~~^~~
combo.cpp:20:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |                 if (c == ans.size())ans.push_back('Y');
      |                     ~~^~~~~~~~~~~~~
combo.cpp:21:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |                 else if (c == ans.size() + 1)ans.push_back('B');
      |                          ~~^~~~~~~~~~~~~~~~~
combo.cpp:22:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |                 else if (c == ans.size() + 2)ans.push_back('X');
      |                          ~~^~~~~~~~~~~~~~~~~
combo.cpp:27:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |                 if (c == ans.size())ans.push_back('Y');
      |                     ~~^~~~~~~~~~~~~
combo.cpp:28:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |                 else if (c == ans.size() + 1)ans.push_back('A');
      |                          ~~^~~~~~~~~~~~~~~~~
combo.cpp:29:28: 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 (c == ans.size() + 2)ans.push_back('X');
      |                          ~~^~~~~~~~~~~~~~~~~
combo.cpp:34:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |                 if (c == ans.size())ans.push_back('Y');
      |                     ~~^~~~~~~~~~~~~
combo.cpp:35:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |                 else if (c == ans.size() + 1)ans.push_back('B');
      |                          ~~^~~~~~~~~~~~~~~~~
combo.cpp:36:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |                 else if (c == ans.size() + 2)ans.push_back('A');
      |                          ~~^~~~~~~~~~~~~~~~~
combo.cpp:41:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |                 if (c == ans.size())ans.push_back('X');
      |                     ~~^~~~~~~~~~~~~
combo.cpp:42:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |                 else if (c == ans.size() + 1)ans.push_back('B');
      |                          ~~^~~~~~~~~~~~~~~~~
combo.cpp:43:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |                 else if (c == ans.size() + 2)ans.push_back('A');
      |                          ~~^~~~~~~~~~~~~~~~~
combo.cpp:47:42: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |         if (press(ans + "A" + ans + "B") == ans.size() + 1) {
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
combo.cpp:48:34: 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 (press(ans + "A") == ans.size() + 1)ans.push_back('A');
      |                 ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
combo.cpp:51:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |             if (press(ans + "X") == ans.size() + 1)ans.push_back('X');
      |                 ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...