# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
848801 | 2023-09-13T13:59:46 Z | TahirAliyev | Password (RMI18_password) | C++17 | 110 ms | 716 KB |
#include <bits/stdc++.h> using namespace std; int query(string str); string a, q; vector<string> v; string merge(string& s1, string& s2){ int p1 = 0, p2 = 0; while(p1 <= s1.size() && p2 < s2.size()){ q = s1; q.insert(q.begin() + p1, s2[p2]); if(query(q) == q.size()){ s1 = q; p2++; } else{ p1++; } } return s1; } bool comp(string& a, string& b){ return a.size() > b.size(); } string guess(int n, int s){ for(char c = 'a'; c <= 'a' + s - 1; c++){ a = ""; for(int i = 1; i <= n; i++){ a += c; } int cnt = query(a); a = ""; for(int i = 1; i <= cnt; i++){ a += c; } v.push_back(a); } sort(v.begin(), v.end(), comp); while(v.size() > 1){ a = merge(v.back(), v[v.size() - 2]); v.pop_back(); v.pop_back(); v.push_back(a); sort(v.begin(), v.end()); } return v[0]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Guessed the password with 87 queries. |
2 | Correct | 1 ms | 600 KB | Guessed the password with 155 queries. |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Guessed the password with 73 queries. |
2 | Runtime error | 1 ms | 436 KB | Execution killed with signal 13 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 37 ms | 696 KB | Guessed the password with 7203 queries. |
2 | Correct | 54 ms | 716 KB | Guessed the password with 10317 queries. |
3 | Correct | 69 ms | 696 KB | Guessed the password with 14101 queries. |
4 | Correct | 110 ms | 708 KB | Guessed the password with 20875 queries. |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Guessed the password with 87 queries. |
2 | Correct | 1 ms | 600 KB | Guessed the password with 155 queries. |
3 | Correct | 1 ms | 344 KB | Guessed the password with 73 queries. |
4 | Runtime error | 1 ms | 436 KB | Execution killed with signal 13 |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Guessed the password with 87 queries. |
2 | Correct | 1 ms | 600 KB | Guessed the password with 155 queries. |
3 | Correct | 1 ms | 344 KB | Guessed the password with 73 queries. |
4 | Runtime error | 1 ms | 436 KB | Execution killed with signal 13 |
5 | Halted | 0 ms | 0 KB | - |