제출 #401584

#제출 시각아이디문제언어결과실행 시간메모리
401584_DaNeK_콤보 (IOI18_combo)C++17
100 / 100
69 ms584 KiB
#include <bits/stdc++.h> using namespace std; vector < char > m = {'A', 'B', 'Y', 'X'}; int press(string p); string guess_sequence(int N) { string res = ""; int tmp = press("AB"); if (tmp > 0) { if (press("A")) { res = "A"; m.erase(m.begin()); } else { res = "B"; m.erase(m.begin() + 1); } } else { if (press("X")) { res = "X"; m.erase(m.begin() + 3); } else { res = "Y"; m.erase(m.begin() + 2); } } if (N == 1) return res; int cur = 2; while (res.size() < N - 1) { string s = res + m[0] + res + m[1] + m[0] + res + m[1] + m[1] + res + m[1] + m[2]; int tmp = press(s); if (tmp == cur - 1) res += m[2]; else { if (tmp == cur) res += m[0]; else res += m[1]; } ++cur; } if (press(res + m[0]) == cur) res += m[0]; else if (press(res + m[1]) == cur) res += m[1]; else res += m[2]; return res; }

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

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