제출 #1110888

#제출 시각아이디문제언어결과실행 시간메모리
1110888HasanV11010238콤보 (IOI18_combo)C++17
5 / 100
1 ms508 KiB
#include "combo.h" #include <vector> using namespace std; vector<char> c = {'A', 'B', 'X', 'Y'}; string guess_sequence(int N){ string ans = "", q; int l = 0, r = 3; while (l != r){ int mid = (l + r) / 2; q = ""; for (int i = l; i <= mid; i++){ q += c[i]; } if (press(q) == 0){ l = mid + 1; } else{ r = mid; } } vector<char> al; for (int i = 0; i < 4; i++){ if (l != i){ al.push_back(c[i]); } } ans += c[l]; for (int i = 0; i < N - 2; i++){ q = ans + al[0] + ans + al[1] + al[0] + ans + al[1] + al[1] + ans + al[1] + al[2]; int res = press(q); if (res == ans.size()){ ans += al[2]; } else if (res == ans.size() + 1){ ans += al[0]; } else{ ans += al[1]; } } if (press(ans + al[0]) == N) return ans + al[0]; if (press(ans + al[1]) == N) return ans + al[1]; return ans + al[2]; }

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

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