답안 #199683

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
199683 2020-02-02T18:11:36 Z zoooma13 Password (RMI18_password) C++14
50 / 100
611 ms 460 KB
#include <bits/stdc++.h>
using namespace std;
 
int query(string s);
 
string guess(int n ,int s){
    pair <int ,int> frq[s];
    for(char c='a'; c<'a'+s; c++)
        frq[c-'a'] = {query(string(n ,c)) ,c};
 
    int lst = 0;
    string ans;
    for(int j=0; j<s; j++){
        char c = frq[j].second;
 
        for(int i=0; frq[j].first && ans.size()<n && i<=ans.size(); i++){
            string ss = ans;
            ss.insert(ss.begin()+i ,c);
            int q = query(ss);
            if(q > lst){
                ans = ss;
                lst = q;
                frq[j].first--;
            }
        }
    }
 
    return ans;
}

Compilation message

password.cpp: In function 'std::__cxx11::string guess(int, int)':
password.cpp:16:48: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0; frq[j].first && ans.size()<n && i<=ans.size(); i++){
                                      ~~~~~~~~~~^~
password.cpp:16:55: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0; frq[j].first && ans.size()<n && i<=ans.size(); i++){
                                                      ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 248 KB Guessed the password with 77 queries.
2 Correct 7 ms 376 KB Guessed the password with 188 queries.
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 376 KB Guessed the password with 72 queries.
2 Correct 7 ms 248 KB Guessed the password with 164 queries.
3 Correct 6 ms 380 KB Guessed the password with 103 queries.
4 Correct 7 ms 376 KB Guessed the password with 229 queries.
# 결과 실행 시간 메모리 Grader output
1 Correct 68 ms 248 KB Guessed the password with 4581 queries.
2 Correct 153 ms 376 KB Guessed the password with 10303 queries.
3 Correct 130 ms 248 KB Guessed the password with 12561 queries.
4 Correct 198 ms 460 KB Guessed the password with 20501 queries.
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 248 KB Guessed the password with 77 queries.
2 Correct 7 ms 376 KB Guessed the password with 188 queries.
3 Correct 6 ms 376 KB Guessed the password with 72 queries.
4 Correct 7 ms 248 KB Guessed the password with 164 queries.
5 Correct 6 ms 380 KB Guessed the password with 103 queries.
6 Correct 7 ms 376 KB Guessed the password with 229 queries.
7 Correct 68 ms 248 KB Guessed the password with 4581 queries.
8 Correct 153 ms 376 KB Guessed the password with 10303 queries.
9 Correct 130 ms 248 KB Guessed the password with 12561 queries.
10 Correct 198 ms 460 KB Guessed the password with 20501 queries.
11 Incorrect 611 ms 248 KB Could not guess the password with 50000 queries.
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 248 KB Guessed the password with 77 queries.
2 Correct 7 ms 376 KB Guessed the password with 188 queries.
3 Correct 6 ms 376 KB Guessed the password with 72 queries.
4 Correct 7 ms 248 KB Guessed the password with 164 queries.
5 Correct 6 ms 380 KB Guessed the password with 103 queries.
6 Correct 7 ms 376 KB Guessed the password with 229 queries.
7 Correct 68 ms 248 KB Guessed the password with 4581 queries.
8 Correct 153 ms 376 KB Guessed the password with 10303 queries.
9 Correct 130 ms 248 KB Guessed the password with 12561 queries.
10 Correct 198 ms 460 KB Guessed the password with 20501 queries.
11 Incorrect 611 ms 248 KB Could not guess the password with 50000 queries.
12 Halted 0 ms 0 KB -