Submission #199682

# Submission time Handle Problem Language Result Execution time Memory
199682 2020-02-02T18:09:53 Z zoooma13 Password (RMI18_password) C++14
80 / 100
712 ms 528 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};
    sort(frq ,frq+s);

    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:17: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:17: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++){
                                                      ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 6 ms 248 KB Guessed the password with 77 queries.
2 Correct 8 ms 252 KB Guessed the password with 188 queries.
# Verdict Execution time Memory Grader output
1 Correct 6 ms 300 KB Guessed the password with 72 queries.
2 Correct 6 ms 248 KB Guessed the password with 99 queries.
3 Correct 7 ms 248 KB Guessed the password with 93 queries.
4 Correct 7 ms 376 KB Guessed the password with 187 queries.
# Verdict Execution time Memory Grader output
1 Correct 36 ms 376 KB Guessed the password with 3134 queries.
2 Correct 100 ms 376 KB Guessed the password with 9218 queries.
3 Correct 57 ms 252 KB Guessed the password with 5202 queries.
4 Correct 146 ms 376 KB Guessed the password with 13858 queries.
# Verdict Execution time Memory Grader output
1 Correct 6 ms 248 KB Guessed the password with 77 queries.
2 Correct 8 ms 252 KB Guessed the password with 188 queries.
3 Correct 6 ms 300 KB Guessed the password with 72 queries.
4 Correct 6 ms 248 KB Guessed the password with 99 queries.
5 Correct 7 ms 248 KB Guessed the password with 93 queries.
6 Correct 7 ms 376 KB Guessed the password with 187 queries.
7 Correct 36 ms 376 KB Guessed the password with 3134 queries.
8 Correct 100 ms 376 KB Guessed the password with 9218 queries.
9 Correct 57 ms 252 KB Guessed the password with 5202 queries.
10 Correct 146 ms 376 KB Guessed the password with 13858 queries.
11 Correct 123 ms 376 KB Guessed the password with 9348 queries.
12 Correct 131 ms 376 KB Guessed the password with 9405 queries.
13 Correct 213 ms 448 KB Guessed the password with 17814 queries.
14 Correct 210 ms 376 KB Guessed the password with 18090 queries.
15 Correct 145 ms 376 KB Guessed the password with 14446 queries.
16 Correct 163 ms 248 KB Guessed the password with 14325 queries.
17 Correct 163 ms 376 KB Guessed the password with 12188 queries.
18 Correct 151 ms 404 KB Guessed the password with 12217 queries.
19 Correct 99 ms 376 KB Guessed the password with 10934 queries.
20 Correct 175 ms 528 KB Guessed the password with 11170 queries.
21 Correct 222 ms 376 KB Guessed the password with 15076 queries.
22 Correct 161 ms 504 KB Guessed the password with 15000 queries.
# Verdict Execution time Memory Grader output
1 Correct 6 ms 248 KB Guessed the password with 77 queries.
2 Correct 8 ms 252 KB Guessed the password with 188 queries.
3 Correct 6 ms 300 KB Guessed the password with 72 queries.
4 Correct 6 ms 248 KB Guessed the password with 99 queries.
5 Correct 7 ms 248 KB Guessed the password with 93 queries.
6 Correct 7 ms 376 KB Guessed the password with 187 queries.
7 Correct 36 ms 376 KB Guessed the password with 3134 queries.
8 Correct 100 ms 376 KB Guessed the password with 9218 queries.
9 Correct 57 ms 252 KB Guessed the password with 5202 queries.
10 Correct 146 ms 376 KB Guessed the password with 13858 queries.
11 Correct 123 ms 376 KB Guessed the password with 9348 queries.
12 Correct 131 ms 376 KB Guessed the password with 9405 queries.
13 Correct 213 ms 448 KB Guessed the password with 17814 queries.
14 Correct 210 ms 376 KB Guessed the password with 18090 queries.
15 Correct 145 ms 376 KB Guessed the password with 14446 queries.
16 Correct 163 ms 248 KB Guessed the password with 14325 queries.
17 Correct 163 ms 376 KB Guessed the password with 12188 queries.
18 Correct 151 ms 404 KB Guessed the password with 12217 queries.
19 Correct 99 ms 376 KB Guessed the password with 10934 queries.
20 Correct 175 ms 528 KB Guessed the password with 11170 queries.
21 Correct 222 ms 376 KB Guessed the password with 15076 queries.
22 Correct 161 ms 504 KB Guessed the password with 15000 queries.
23 Execution timed out 712 ms 456 KB Time limit exceeded (wall clock)
24 Halted 0 ms 0 KB -