제출 #331744

#제출 시각아이디문제언어결과실행 시간메모리
331744dolphingarlicPassword (RMI18_password)C++14
0 / 100
20 ms364 KiB
#include <string> using namespace std; extern int query(string str); string solve(int l, int r, int n) { if (l == r) { string to_guess = ""; for (int i = 0; i < n; i++) to_guess += 'a' + l; int len = query(to_guess); string ret = ""; for (int i = 0; i < len; i++) ret += 'a' + l; return ret; } else { int mid = (l + r) / 2; string a = solve(l, mid, n), b = solve(mid + 1, r, n); int a_ptr = 0, b_ptr = 0; string known = ""; while (a_ptr < a.size() && b_ptr < b.size()) { string to_guess = known + a[a_ptr]; if (query(to_guess) > known.size()) known += a[a_ptr++]; else known += b[b_ptr++]; } while (a_ptr < a.size()) known += a[a_ptr++]; while (b_ptr < b.size()) known += b[b_ptr++]; return known; } } string guess(int n, int s) { return solve(0, s - 1, n); }

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

password.cpp: In function 'std::string solve(int, int, int)':
password.cpp:19:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         while (a_ptr < a.size() && b_ptr < b.size()) {
      |                ~~~~~~^~~~~~~~~~
password.cpp:19:42: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         while (a_ptr < a.size() && b_ptr < b.size()) {
      |                                    ~~~~~~^~~~~~~~~~
password.cpp:21:33: 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 (query(to_guess) > known.size()) known += a[a_ptr++];
      |                 ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
password.cpp:24:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |         while (a_ptr < a.size()) known += a[a_ptr++];
      |                ~~~~~~^~~~~~~~~~
password.cpp:25:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |         while (b_ptr < b.size()) known += b[b_ptr++];
      |                ~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...