제출 #726553

#제출 시각아이디문제언어결과실행 시간메모리
726553horiseun콤보 (IOI18_combo)C++11
0 / 100
0 ms208 KiB
#include "combo.h" #include <vector> #include <cstring> using namespace std; string guess_sequence(int n) { vector<char> letters = {'A', 'B', 'X', 'Y'}; string ans = ""; for (int i = 0; i < 4; i++) { ans += letters[i]; if (press(ans) > 0) { letters.erase(letters.begin() + i); break; } ans.pop_back(); } while (ans.length() <= n - 2) { string gs = ans + letters[1] + letters[0] + ans + letters[1] + letters[1] + ans + letters[1] + letters[2]; int temp = press(gs); if (temp == ans.size() + 1) { ans += letters[0]; } else if (temp == ans.size() + 2) { ans += letters[1]; } else { ans += letters[2]; } } for (int i = 0; i < 3; i++) { ans += letters[i]; if (press(ans) == n) { break; } ans.pop_back(); } return ans; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:18:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   18 |     while (ans.length() <= n - 2) {
      |            ~~~~~~~~~~~~~^~~~~~~~
combo.cpp:21:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |         if (temp == ans.size() + 1) {
      |             ~~~~~^~~~~~~~~~~~~~~~~
combo.cpp:23:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |         } else if (temp == ans.size() + 2) {
      |                    ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...