제출 #228775

#제출 시각아이디문제언어결과실행 시간메모리
228775two_sides콤보 (IOI18_combo)C++17
100 / 100
40 ms580 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n){ string res; vector <char> c = {'A', 'B', 'X', 'Y'}; if (press("AB") >= 1) res = press("A") ? "A" : "B"; else res = press("X") ? "X" : "Y"; c.erase(find(c.begin(), c.end(), res[0])); while (int(size(res)) <= n - 2){ int que = press(res + c[0] + res + c[1] + c[0] + res + c[1] + c[1] + res + c[1] + c[2]); if (que == size(res)) res.push_back(c[2]); if (que == size(res) + 1) res.push_back(c[0]); if (que == size(res) + 2) res.push_back(c[1]); } if (int(size(res)) < n){ if (press(res + c[0]) == n) res.push_back(c[0]); else if (press(res + c[1]) == n) res.push_back(c[1]); else res.push_back(c[2]); } return res; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:12:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     if (que == size(res)) res.push_back(c[2]);
      |         ~~~~^~~~~~~~~~~~
combo.cpp:13:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     if (que == size(res) + 1) res.push_back(c[0]);
      |         ~~~~^~~~~~~~~~~~~~~~
combo.cpp:14:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     if (que == size(res) + 2) res.push_back(c[1]);
      |         ~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...