제출 #331743

#제출 시각아이디문제언어결과실행 시간메모리
331743dolphingarlicPassword (RMI18_password)C++14
0 / 100
431 ms396 KiB
#include <string> using namespace std; int query(string str); int cnt = 0; 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); cnt++; 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++]; cnt++; } 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) { string ret = solve(0, s - 1, n); while (cnt++ < 50000) query(ret); return ret; }

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

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