# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
756920 | 2023-06-12T11:18:32 Z | ElyesChaabouni | Password (RMI18_password) | C++17 | 4 ms | 464 KB |
#include <bits/stdc++.h> using namespace std; int query(string str); string str, endChars, build, tmp, nEnd; string guess(int n, int s) { endChars=""; vector<int> freq(s); for (int i = 0; i < s; i++) { str=""; for (int it = 0; it < n; it++) { str += (i + 'a'); } freq[i] = query(str); } for (int pos = n - 1; pos >= 0; pos--) { for (int i = 0; i < s; i++) { if (freq[i] > 0) { build; for (int it = 0; it < freq[i]; it++) { build += (i + 'a'); } bool work = true; if ((int) build.size() + 1 + (int) endChars.size() <= n) { for (int j = 0; j < s; j++) { tmp=""; tmp += build; tmp += (j + 'a'); tmp += endChars; if (query(tmp) == (int) tmp.length()) { work = false; break; } } } if (work) { freq[i] -= 1; nEnd=""; nEnd += (i + 'a'); nEnd += endChars; swap(nEnd, endChars); break; } } } } return endChars; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 208 KB | Returned early from guess() after 111 queries. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 296 KB | Returned early from guess() after 7 queries. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 464 KB | Returned early from guess() after 380 queries. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 208 KB | Returned early from guess() after 111 queries. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 208 KB | Returned early from guess() after 111 queries. |
2 | Halted | 0 ms | 0 KB | - |