제출 #411604

#제출 시각아이디문제언어결과실행 시간메모리
411604nichke콤보 (IOI18_combo)C++14
100 / 100
45 ms592 KiB
#include <bits/stdc++.h> using namespace std; int press(string p); string guess_sequence(int n) { string but = "AB"; string res = ""; if (!press(but)) but = "XY"; char ff = but[0]; if (!press(but.substr(0, 1))) ff = but[1]; but = "ABXY"; string bt = ""; for (char c : but) { if (c == ff) continue; bt += c; } res += ff; if (n <= 1) { return res; } while (res.size() < n - 1) { res += bt[press(res + bt[1] + res + bt[2] + bt[0] + res + bt[2] + bt[1] + res + bt[2] + bt[2]) - res.size()]; } if (press(res + bt[0] + res + bt[1]) > res.size()) { if (press(res + bt[0]) > res.size()) return res + bt[0]; return res + bt[1]; } return res + bt[2]; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:22:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |  while (res.size() < n - 1) {
      |         ~~~~~~~~~~~^~~~~~~
combo.cpp:25:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |  if (press(res + bt[0] + res + bt[1]) > res.size()) {
      |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:26:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |   if (press(res + bt[0]) > res.size()) return res + bt[0];
      |       ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...