제출 #937079

#제출 시각아이디문제언어결과실행 시간메모리
937079Muaath_5콤보 (IOI18_combo)C++17
100 / 100
17 ms1860 KiB
#ifdef MUAATH_5 #include "ioi.h" #else #include "combo.h" #endif #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { string sol = ""; vector<string> p = {"A", "B", "X", "Y"}; if (press("AB")) { if (press("A")) sol += "A"; else sol += "B"; } else { if (press("X")) sol += "X"; else sol += "Y"; } p.erase(find(p.begin(), p.end(), sol)); if (n == 1) return sol; for (int i = 1; i < n-1; i++) { string ask = ""; for (auto x : p) ask += sol + p[0] + x; ask += sol + p[1]; int res = press(ask); if (res == i + 2) sol += p[0]; else if (res == i + 1) sol += p[1]; else sol += p[2]; } if (press(sol + p[0] + sol + p[1]) == sol.size() + 1) { if (press(sol + p[0]) == sol.size() + 1) sol += p[0]; else sol += p[1]; } else { sol += p[2]; } return sol; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:44:37: 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 (press(sol + p[0] + sol + p[1]) == sol.size() + 1) {
      |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
combo.cpp:45:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |   if (press(sol + p[0]) == sol.size() + 1)
      |       ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...