Submission #199693

# Submission time Handle Problem Language Result Execution time Memory
199693 2020-02-02T20:38:40 Z Osama_Alkhodairy Password (RMI18_password) C++17
100 / 100
384 ms 580 KB
#include <bits/stdc++.h>
//~ #include "grader.cpp"
using namespace std;

int query(string s);
string guess(int n, int c){
    vector <int> f(c);
    for(char i = 'a' ; i < 'a' + c ; i++){
        f[i - 'a'] = query(string(n, i));
    }
    string ans;
    for(char i = 'a' ; i < 'a' + c ; i++){
        string cur = ans;
        int e = ans.size();
        for(int j = 0 ; j < f[i - 'a'] ; j++){
            while(e >= 15 && query(ans.substr(0, e - 15) + string(j + 1, i)) != e - 15 + j + 1){
                e -= 16;
            }
            int l = max(0, e - 15), r = e;
            while(l <= r){
                int mid = (l + r) / 2;
                if(query(ans.substr(0, mid) + string(j + 1, i)) == mid + j + 1) l = mid + 1;
                else r = mid - 1;
            }
            cur.insert(cur.begin() + r, i);
        }
        ans = cur;
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 376 KB Guessed the password with 61 queries.
2 Correct 6 ms 376 KB Guessed the password with 108 queries.
# Verdict Execution time Memory Grader output
1 Correct 6 ms 248 KB Guessed the password with 117 queries.
2 Correct 7 ms 376 KB Guessed the password with 161 queries.
3 Correct 9 ms 248 KB Guessed the password with 334 queries.
4 Correct 11 ms 248 KB Guessed the password with 412 queries.
# Verdict Execution time Memory Grader output
1 Correct 58 ms 376 KB Guessed the password with 5238 queries.
2 Correct 71 ms 380 KB Guessed the password with 6790 queries.
3 Correct 97 ms 376 KB Guessed the password with 8542 queries.
4 Correct 115 ms 252 KB Guessed the password with 11029 queries.
# Verdict Execution time Memory Grader output
1 Correct 6 ms 376 KB Guessed the password with 61 queries.
2 Correct 6 ms 376 KB Guessed the password with 108 queries.
3 Correct 6 ms 248 KB Guessed the password with 117 queries.
4 Correct 7 ms 376 KB Guessed the password with 161 queries.
5 Correct 9 ms 248 KB Guessed the password with 334 queries.
6 Correct 11 ms 248 KB Guessed the password with 412 queries.
7 Correct 58 ms 376 KB Guessed the password with 5238 queries.
8 Correct 71 ms 380 KB Guessed the password with 6790 queries.
9 Correct 97 ms 376 KB Guessed the password with 8542 queries.
10 Correct 115 ms 252 KB Guessed the password with 11029 queries.
11 Correct 174 ms 504 KB Guessed the password with 13827 queries.
12 Correct 188 ms 508 KB Guessed the password with 14752 queries.
13 Correct 185 ms 508 KB Guessed the password with 16725 queries.
14 Correct 200 ms 376 KB Guessed the password with 16093 queries.
15 Correct 138 ms 248 KB Guessed the password with 16985 queries.
16 Correct 183 ms 376 KB Guessed the password with 16991 queries.
17 Correct 166 ms 376 KB Guessed the password with 17551 queries.
18 Correct 251 ms 248 KB Guessed the password with 17339 queries.
19 Correct 228 ms 504 KB Guessed the password with 17085 queries.
20 Correct 227 ms 248 KB Guessed the password with 17910 queries.
21 Correct 225 ms 504 KB Guessed the password with 18703 queries.
22 Correct 215 ms 376 KB Guessed the password with 18737 queries.
# Verdict Execution time Memory Grader output
1 Correct 6 ms 376 KB Guessed the password with 61 queries.
2 Correct 6 ms 376 KB Guessed the password with 108 queries.
3 Correct 6 ms 248 KB Guessed the password with 117 queries.
4 Correct 7 ms 376 KB Guessed the password with 161 queries.
5 Correct 9 ms 248 KB Guessed the password with 334 queries.
6 Correct 11 ms 248 KB Guessed the password with 412 queries.
7 Correct 58 ms 376 KB Guessed the password with 5238 queries.
8 Correct 71 ms 380 KB Guessed the password with 6790 queries.
9 Correct 97 ms 376 KB Guessed the password with 8542 queries.
10 Correct 115 ms 252 KB Guessed the password with 11029 queries.
11 Correct 174 ms 504 KB Guessed the password with 13827 queries.
12 Correct 188 ms 508 KB Guessed the password with 14752 queries.
13 Correct 185 ms 508 KB Guessed the password with 16725 queries.
14 Correct 200 ms 376 KB Guessed the password with 16093 queries.
15 Correct 138 ms 248 KB Guessed the password with 16985 queries.
16 Correct 183 ms 376 KB Guessed the password with 16991 queries.
17 Correct 166 ms 376 KB Guessed the password with 17551 queries.
18 Correct 251 ms 248 KB Guessed the password with 17339 queries.
19 Correct 228 ms 504 KB Guessed the password with 17085 queries.
20 Correct 227 ms 248 KB Guessed the password with 17910 queries.
21 Correct 225 ms 504 KB Guessed the password with 18703 queries.
22 Correct 215 ms 376 KB Guessed the password with 18737 queries.
23 Correct 295 ms 520 KB Guessed the password with 28707 queries.
24 Correct 311 ms 580 KB Guessed the password with 28049 queries.
25 Correct 328 ms 556 KB Guessed the password with 28619 queries.
26 Correct 316 ms 520 KB Guessed the password with 29922 queries.
27 Correct 384 ms 452 KB Guessed the password with 28739 queries.
28 Correct 342 ms 456 KB Guessed the password with 29277 queries.
29 Correct 301 ms 352 KB Guessed the password with 28798 queries.
30 Correct 364 ms 516 KB Guessed the password with 26745 queries.