제출 #835487

#제출 시각아이디문제언어결과실행 시간메모리
835487KemalK콤보 (IOI18_combo)C++17
0 / 100
1 ms208 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int n) { string s = ""; string cur = "ABXY"; bool ok = false; for (int i = 0; i < 3; i++){ if (press(s + cur[i])){ s += cur[i]; ok = true; break; } } if (!ok){ s += cur[3]; } string rem = ""; for (int i = 0; i < 4; i++){ if (s[0] != cur[i]){ rem += cur[i]; } } int cnt = 1; for (int i = 1; i < n - 1; i++){ string p = s + rem[0]; for (int j = 0; j < 3; j++){ p += s + rem[1] + rem[j]; } int point = press(p); if (point == cnt + 1){ s += rem[0]; } else if (point == cnt){ s += rem[2]; } else{ s += rem[1]; } cnt++; } while(s.size() != n){ if (press(s + rem[0]) == cnt + 1){ s += rem[0]; } else if (press(s + rem[1]) == cnt + 1){ s += rem[1]; } else{ s += rem[2]; } } cout << s << "\n"; return s; }

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

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