제출 #124963

#제출 시각아이디문제언어결과실행 시간메모리
124963teomrn콤보 (IOI18_combo)C++14
5 / 100
2 ms416 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() <= N - 2) { /// mai pot adauga 2 chestii string query = S + oth1 + oth1 + S + oth1 + oth2 + S + oth1 + oth3 + S + oth2; assert(query.size() <= 4 * N); for (auto i : query) { if (i != 'A' && i != 'B' && i != 'X' && i != 'Y') while (1); } 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; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:24:18: 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() <= N - 2) {
      |         ~~~~~~~~~^~~~~~~~
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(query.size() <= 4 * N);
      |          ~~~~~~~~~~~~~^~~~~~~~
combo.cpp:33:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |   if (ans == S.size() + 2)
      |       ~~~~^~~~~~~~~~~~~~~
combo.cpp:35:16: 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 (ans == S.size() + 1)
      |            ~~~~^~~~~~~~~~~~~~~
combo.cpp:41:15: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   41 |  if (S.size() != N) {
      |      ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...