답안 #464481

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
464481 2021-08-13T09:38:09 Z osmanallazov Password (RMI18_password) C++14
10 / 100
105 ms 548 KB
#include <bits/stdc++.h>
using namespace std;
int query(string str);
string guess(int n, int s) {
    string ans="";
    for (int i=0;i<n;i++){
        for (char x='a';x<'a'+s;x++) {
            if (ans.size()<n) {
                ans.insert(ans.begin()+i,x);
                if (query(ans)!=ans.size())ans.erase(ans.begin()+i,ans.begin()+i+1);
            }
        }
    }
    return ans;
}

Compilation message

password.cpp: In function 'std::string guess(int, int)':
password.cpp:8:27: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    8 |             if (ans.size()<n) {
      |                 ~~~~~~~~~~^~
password.cpp:10:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |                 if (query(ans)!=ans.size())ans.erase(ans.begin()+i,ans.begin()+i+1);
      |                     ~~~~~~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 200 KB Guessed the password with 210 queries.
2 Correct 5 ms 200 KB Guessed the password with 482 queries.
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 456 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 105 ms 548 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 200 KB Guessed the password with 210 queries.
2 Correct 5 ms 200 KB Guessed the password with 482 queries.
3 Runtime error 2 ms 456 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 200 KB Guessed the password with 210 queries.
2 Correct 5 ms 200 KB Guessed the password with 482 queries.
3 Runtime error 2 ms 456 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -