Submission #332532

# Submission time Handle Problem Language Result Execution time Memory
332532 2020-12-02T19:31:13 Z xt0r3 Password (RMI18_password) C++14
100 / 100
293 ms 820 KB
#include<bits/stdc++.h>
using namespace std;

int query(string str);

string merge(const vector<string>& sol, int lo, int hi){
	if(lo == hi) return sol[lo];
	int mi = (lo + hi) / 2;
	string s1 = merge(sol, lo, mi), s2 = merge(sol, mi + 1, hi), res = "";
	int curr = 0, dex = 0;
	while(curr < (int)s1.size() && dex < (int)s2.size()){
		if(query(res + s2[dex] + s1.substr(curr)) == (int)res.size() + (int)s1.size() - curr + 1) res += s2[dex++];
		else res += s1[curr++];
	}
	return res + s1.substr(curr) + s2.substr(dex);
}

string guess(int n, int s){
	vector<string> sol(s, "");
	for(int i = 0; i < s; i++){
        string ss(n, 'a' + i);
		sol[i].assign(query(ss), 'a' + i);
	}
	return merge(sol, 0, s - 1);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Guessed the password with 60 queries.
2 Correct 1 ms 364 KB Guessed the password with 100 queries.
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Guessed the password with 48 queries.
2 Correct 2 ms 364 KB Guessed the password with 116 queries.
3 Correct 2 ms 364 KB Guessed the password with 91 queries.
4 Correct 3 ms 364 KB Guessed the password with 198 queries.
# Verdict Execution time Memory Grader output
1 Correct 30 ms 380 KB Guessed the password with 3455 queries.
2 Correct 49 ms 492 KB Guessed the password with 5024 queries.
3 Correct 78 ms 620 KB Guessed the password with 6353 queries.
4 Correct 88 ms 620 KB Guessed the password with 8694 queries.
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Guessed the password with 60 queries.
2 Correct 1 ms 364 KB Guessed the password with 100 queries.
3 Correct 1 ms 384 KB Guessed the password with 48 queries.
4 Correct 2 ms 364 KB Guessed the password with 116 queries.
5 Correct 2 ms 364 KB Guessed the password with 91 queries.
6 Correct 3 ms 364 KB Guessed the password with 198 queries.
7 Correct 30 ms 380 KB Guessed the password with 3455 queries.
8 Correct 49 ms 492 KB Guessed the password with 5024 queries.
9 Correct 78 ms 620 KB Guessed the password with 6353 queries.
10 Correct 88 ms 620 KB Guessed the password with 8694 queries.
11 Correct 127 ms 552 KB Guessed the password with 13637 queries.
12 Correct 137 ms 564 KB Guessed the password with 12460 queries.
13 Correct 128 ms 500 KB Guessed the password with 14391 queries.
14 Correct 156 ms 364 KB Guessed the password with 13938 queries.
15 Correct 138 ms 804 KB Guessed the password with 15072 queries.
16 Correct 164 ms 556 KB Guessed the password with 14153 queries.
17 Correct 148 ms 748 KB Guessed the password with 16053 queries.
18 Correct 147 ms 764 KB Guessed the password with 15190 queries.
19 Correct 149 ms 748 KB Guessed the password with 16409 queries.
20 Correct 164 ms 620 KB Guessed the password with 14248 queries.
21 Correct 175 ms 568 KB Guessed the password with 16848 queries.
22 Correct 175 ms 568 KB Guessed the password with 15316 queries.
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Guessed the password with 60 queries.
2 Correct 1 ms 364 KB Guessed the password with 100 queries.
3 Correct 1 ms 384 KB Guessed the password with 48 queries.
4 Correct 2 ms 364 KB Guessed the password with 116 queries.
5 Correct 2 ms 364 KB Guessed the password with 91 queries.
6 Correct 3 ms 364 KB Guessed the password with 198 queries.
7 Correct 30 ms 380 KB Guessed the password with 3455 queries.
8 Correct 49 ms 492 KB Guessed the password with 5024 queries.
9 Correct 78 ms 620 KB Guessed the password with 6353 queries.
10 Correct 88 ms 620 KB Guessed the password with 8694 queries.
11 Correct 127 ms 552 KB Guessed the password with 13637 queries.
12 Correct 137 ms 564 KB Guessed the password with 12460 queries.
13 Correct 128 ms 500 KB Guessed the password with 14391 queries.
14 Correct 156 ms 364 KB Guessed the password with 13938 queries.
15 Correct 138 ms 804 KB Guessed the password with 15072 queries.
16 Correct 164 ms 556 KB Guessed the password with 14153 queries.
17 Correct 148 ms 748 KB Guessed the password with 16053 queries.
18 Correct 147 ms 764 KB Guessed the password with 15190 queries.
19 Correct 149 ms 748 KB Guessed the password with 16409 queries.
20 Correct 164 ms 620 KB Guessed the password with 14248 queries.
21 Correct 175 ms 568 KB Guessed the password with 16848 queries.
22 Correct 175 ms 568 KB Guessed the password with 15316 queries.
23 Correct 230 ms 596 KB Guessed the password with 23613 queries.
24 Correct 258 ms 820 KB Guessed the password with 22227 queries.
25 Correct 293 ms 772 KB Guessed the password with 23795 queries.
26 Correct 278 ms 696 KB Guessed the password with 23333 queries.
27 Correct 225 ms 672 KB Guessed the password with 23764 queries.
28 Correct 212 ms 660 KB Guessed the password with 23044 queries.
29 Correct 247 ms 680 KB Guessed the password with 23848 queries.
30 Correct 200 ms 636 KB Guessed the password with 22507 queries.