제출 #984511

#제출 시각아이디문제언어결과실행 시간메모리
984511kachim2콤보 (IOI18_combo)C++14
0 / 100
30 ms7344 KiB
#include "combo.h" #include <iostream> std::string guess_sequence(int N) { std::string S = ""; if (press("AB") != 0) { if (press("A") == 1) { S = 'A'; } else { S='B'; } } else { if (press("X") == 1) { S = 'X'; } else { S = 'Y'; } } std::string A = "A", B = "B", C = "X"; switch (S[0]) { case 'A': A = "Y"; break; case 'B': B = "Y"; break; case 'X': C = "Y"; break; default: break; }; for (int i = 1; i < N - 1; i++) { std::cerr << S + A + S + B + C + S + B + A << '\n'; int ans = press(S + A + S + B + C + S + B + A); if (ans == i+1) { S+=A; } else if (ans == i+2){ S+=B; } else { S+=C; } } if(N!=1) if (press(S + A) == S.size()) { if (press(S + B) == S.size()) { S+= C; } else { S+=B; } } else { S+=A; } std::cerr << S; return S; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:49:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |   if (press(S + A) == S.size()) {
      |       ~~~~~~~~~~~~~^~~~~~~~~~~
combo.cpp:50:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |     if (press(S + B) == S.size()) {
      |         ~~~~~~~~~~~~~^~~~~~~~~~~
combo.cpp:48:5: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
   48 |   if(N!=1)
      |     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...