제출 #348560

#제출 시각아이디문제언어결과실행 시간메모리
348560Halogen콤보 (IOI18_combo)C++14
100 / 100
44 ms680 KiB
#include "combo.h" std::string guess_sequence(int N) { char lst[4] = {'A', 'B', 'X', 'Y'}; std::string p = ""; if (press(lst[0] + p + lst[1]) >= 1) { if (press(p + lst[0]) == 1){ p += lst[0]; lst[0] = lst[3]; } else { p += lst[1]; lst[1] = lst[3]; } } else if (press(p + lst[2]) == 1) { p += lst[2]; lst[2] = lst[3]; } else { p += lst[3]; } for (int j = 2; j < N; j++) { int result = press(p + lst[0] + p + lst[1] + lst[0] + p + lst[1] + lst[1] + p + lst[1] + lst[2]); if (result == j) p += lst[0]; else if (result == j + 1) p += lst[1]; else p += lst[2]; } if (p.size() == N) return p; else if (press(p + lst[2]) == N) p += lst[2]; else if (press(p + lst[0]) == N) p += lst[0]; else p += lst[1]; return p; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:32:16: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   32 |   if (p.size() == N) return p;
      |       ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...