Submission #251379

# Submission time Handle Problem Language Result Execution time Memory
251379 2020-07-21T04:48:02 Z cheeheng Password (RMI18_password) C++14
50 / 100
518 ms 384 KB
#include <bits/stdc++.h>
using namespace std;

int query(string q);

string guess(int n, int s){
    int cnt[28];
    for(char i = 'a'; i < 'a'+s; i ++){
        string temp = "";
        for(int j = 0; j < n; j ++){
            temp += i;
        }
        cnt[i-'a'] = query(temp);
    }

    string temp = "";
    int cntMatch = 0;
    for(int i = 0; i < s; i ++){
        int indx = 0;
        int j = 0;
        while(j < cnt[i]){
            string temp2 = temp;
            if(indx == 0){
                temp2 = (char)('a'+i) + temp;
            }else{
                temp2 = temp2.substr(0, indx) + (char)('a'+i) + temp2.substr(indx);
            }
            //printf("%d: %s %s\n", j, temp.c_str(), temp2.c_str());
            int res = query(temp2);
            if(res > cntMatch){
                temp = temp2;
                cntMatch = res;
                j ++;
            }
            indx ++;
        }
    }

    return temp;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Guessed the password with 77 queries.
2 Correct 2 ms 256 KB Guessed the password with 188 queries.
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Guessed the password with 72 queries.
2 Correct 3 ms 256 KB Guessed the password with 164 queries.
3 Correct 1 ms 256 KB Guessed the password with 103 queries.
4 Correct 4 ms 256 KB Guessed the password with 229 queries.
# Verdict Execution time Memory Grader output
1 Correct 55 ms 256 KB Guessed the password with 4581 queries.
2 Correct 141 ms 256 KB Guessed the password with 10303 queries.
3 Correct 114 ms 376 KB Guessed the password with 12561 queries.
4 Correct 214 ms 376 KB Guessed the password with 20501 queries.
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Guessed the password with 77 queries.
2 Correct 2 ms 256 KB Guessed the password with 188 queries.
3 Correct 1 ms 256 KB Guessed the password with 72 queries.
4 Correct 3 ms 256 KB Guessed the password with 164 queries.
5 Correct 1 ms 256 KB Guessed the password with 103 queries.
6 Correct 4 ms 256 KB Guessed the password with 229 queries.
7 Correct 55 ms 256 KB Guessed the password with 4581 queries.
8 Correct 141 ms 256 KB Guessed the password with 10303 queries.
9 Correct 114 ms 376 KB Guessed the password with 12561 queries.
10 Correct 214 ms 376 KB Guessed the password with 20501 queries.
11 Incorrect 518 ms 384 KB Could not guess the password with 50000 queries.
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Guessed the password with 77 queries.
2 Correct 2 ms 256 KB Guessed the password with 188 queries.
3 Correct 1 ms 256 KB Guessed the password with 72 queries.
4 Correct 3 ms 256 KB Guessed the password with 164 queries.
5 Correct 1 ms 256 KB Guessed the password with 103 queries.
6 Correct 4 ms 256 KB Guessed the password with 229 queries.
7 Correct 55 ms 256 KB Guessed the password with 4581 queries.
8 Correct 141 ms 256 KB Guessed the password with 10303 queries.
9 Correct 114 ms 376 KB Guessed the password with 12561 queries.
10 Correct 214 ms 376 KB Guessed the password with 20501 queries.
11 Incorrect 518 ms 384 KB Could not guess the password with 50000 queries.
12 Halted 0 ms 0 KB -