답안 #333346

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
333346 2020-12-05T16:39:34 Z valerikk Password (RMI18_password) C++17
0 / 100
204 ms 632 KB
#include <bits/stdc++.h>
using namespace std;

int query(string str);

string guess(int n, int s) {
    string cur = "";
    string res = "";
    for (int i = 0; i < n; i++) {
        while (true) {
            bool was = false;
            for (char x = 'a'; x < 'a' + s; x++) {
                cur.insert(cur.begin() + i, x);
                if (query(cur) == cur.size()) was = true; else cur.erase(cur.begin() + i);
            }
            if (!was) break;
        }
        assert(cur.size() >= i + 1);
        res.push_back(cur[i]);
    }
    return res;
}

Compilation message

password.cpp: In function 'std::string guess(int, int)':
password.cpp:14:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |                 if (query(cur) == cur.size()) was = true; else cur.erase(cur.begin() + i);
      |                     ~~~~~~~~~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from password.cpp:1:
password.cpp:18:27: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   18 |         assert(cur.size() >= i + 1);
      |                ~~~~~~~~~~~^~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 364 KB Execution killed with signal 13 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 364 KB Execution killed with signal 13 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 204 ms 632 KB Execution killed with signal 13 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 364 KB Execution killed with signal 13 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 364 KB Execution killed with signal 13 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -