제출 #879136

#제출 시각아이디문제언어결과실행 시간메모리
879136spetar76콤보 (IOI18_combo)C++17
100 / 100
14 ms1848 KiB
#include "combo.h" using namespace std; std::string guess_sequence(int N) { string S=""; string ne="QWE"; int qwqw=press("AB"); if (qwqw>0){ int qwerty=press("A"); if (qwerty==1){ S="A"; ne="BXY"; } else{ S="B"; ne="AXY"; } } else{ int qwerty=press("X"); if (qwerty==1){ S="X"; ne="ABY"; } else{ S="Y"; ne="ABX"; } } if (N==1){return S;} else if (N==2){ if (press(S+ne[0])==2){return S+ne[0];} else if (press(S+ne[1])==2){return S+ne[1];} else{return S+ne[2];} } for (int i=2; i<=N-1; ++i){ int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+ne[2]+ne[2] + S+ne[1]); S=S+ne[g-S.length()]; } int gg=press(S+ne[2]); if (gg==S.length()+1){return S+ne[2];} gg=press(S+ne[1]); if (gg==S.length()+1){return S+ne[1];} return S+ne[0]; return S; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:44:11: 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 (gg==S.length()+1){return S+ne[2];}
      |         ~~^~~~~~~~~~~~~~
combo.cpp:47:11: 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 (gg==S.length()+1){return S+ne[1];}
      |         ~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...