# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
848789 | 2023-09-13T13:48:41 Z | TahirAliyev | Password (RMI18_password) | C++17 | 1 ms | 440 KB |
#include <bits/stdc++.h> using namespace std; int query(string str); vector<string> v; string merge(string a, string b){ int p1 = 0, p2 = 0; while(p1 <= a.size() && p2 < b.size()){ string q = a; q.insert(q.begin() + p1, b[p2]); if(query(q) == q.size()){ a = q; p2++; } else{ p1++; } } return a; } 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++){ string s = ""; for(int i = 1; i <= n; i++){ s += c; } int cnt = query(s); s = ""; for(int i = 1; i <= cnt; i++){ s += c; } v.push_back(s); } sort(v.begin(), v.end(), comp); while(v.size() != 1){ string s = merge(v[0], v[1]); v.erase(v.begin()); v.erase(v.begin() + 1); v.push_back(s); sort(v.begin(), v.end()); } return v[0]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Returned early from guess() after 57 queries. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Guessed the password with 73 queries. |
2 | Incorrect | 1 ms | 384 KB | Returned early from guess() after 55 queries. |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 440 KB | Returned early from guess() after 45 queries. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Returned early from guess() after 57 queries. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Returned early from guess() after 57 queries. |
2 | Halted | 0 ms | 0 KB | - |