Submission #332539

# Submission time Handle Problem Language Result Execution time Memory
332539 2020-12-02T20:06:43 Z xt0r3 Password (RMI18_password) C++14
100 / 100
311 ms 1028 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++) sol[i].assign(query(*new string(n, 'a' + i)), '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 2 ms 364 KB Guessed the password with 100 queries.
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 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 2 ms 364 KB Guessed the password with 198 queries.
# Verdict Execution time Memory Grader output
1 Correct 45 ms 364 KB Guessed the password with 3455 queries.
2 Correct 42 ms 508 KB Guessed the password with 5024 queries.
3 Correct 63 ms 492 KB Guessed the password with 6353 queries.
4 Correct 102 ms 364 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 2 ms 364 KB Guessed the password with 100 queries.
3 Correct 1 ms 364 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 2 ms 364 KB Guessed the password with 198 queries.
7 Correct 45 ms 364 KB Guessed the password with 3455 queries.
8 Correct 42 ms 508 KB Guessed the password with 5024 queries.
9 Correct 63 ms 492 KB Guessed the password with 6353 queries.
10 Correct 102 ms 364 KB Guessed the password with 8694 queries.
11 Correct 129 ms 532 KB Guessed the password with 13637 queries.
12 Correct 101 ms 748 KB Guessed the password with 12460 queries.
13 Correct 164 ms 600 KB Guessed the password with 14391 queries.
14 Correct 143 ms 644 KB Guessed the password with 13938 queries.
15 Correct 134 ms 876 KB Guessed the password with 15072 queries.
16 Correct 141 ms 748 KB Guessed the password with 14153 queries.
17 Correct 183 ms 624 KB Guessed the password with 16053 queries.
18 Correct 170 ms 748 KB Guessed the password with 15190 queries.
19 Correct 168 ms 620 KB Guessed the password with 16409 queries.
20 Correct 174 ms 880 KB Guessed the password with 14248 queries.
21 Correct 124 ms 908 KB Guessed the password with 16848 queries.
22 Correct 195 ms 772 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 2 ms 364 KB Guessed the password with 100 queries.
3 Correct 1 ms 364 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 2 ms 364 KB Guessed the password with 198 queries.
7 Correct 45 ms 364 KB Guessed the password with 3455 queries.
8 Correct 42 ms 508 KB Guessed the password with 5024 queries.
9 Correct 63 ms 492 KB Guessed the password with 6353 queries.
10 Correct 102 ms 364 KB Guessed the password with 8694 queries.
11 Correct 129 ms 532 KB Guessed the password with 13637 queries.
12 Correct 101 ms 748 KB Guessed the password with 12460 queries.
13 Correct 164 ms 600 KB Guessed the password with 14391 queries.
14 Correct 143 ms 644 KB Guessed the password with 13938 queries.
15 Correct 134 ms 876 KB Guessed the password with 15072 queries.
16 Correct 141 ms 748 KB Guessed the password with 14153 queries.
17 Correct 183 ms 624 KB Guessed the password with 16053 queries.
18 Correct 170 ms 748 KB Guessed the password with 15190 queries.
19 Correct 168 ms 620 KB Guessed the password with 16409 queries.
20 Correct 174 ms 880 KB Guessed the password with 14248 queries.
21 Correct 124 ms 908 KB Guessed the password with 16848 queries.
22 Correct 195 ms 772 KB Guessed the password with 15316 queries.
23 Correct 197 ms 916 KB Guessed the password with 23613 queries.
24 Correct 161 ms 900 KB Guessed the password with 22227 queries.
25 Correct 311 ms 920 KB Guessed the password with 23795 queries.
26 Correct 196 ms 972 KB Guessed the password with 23333 queries.
27 Correct 260 ms 700 KB Guessed the password with 23764 queries.
28 Correct 234 ms 720 KB Guessed the password with 23044 queries.
29 Correct 274 ms 1028 KB Guessed the password with 23848 queries.
30 Correct 265 ms 644 KB Guessed the password with 22507 queries.