# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
773221 | TheSahib | Password (RMI18_password) | C++14 | 436 ms | 452 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
using namespace std;
int cnt[30];
int query(string s);
string guess(int n, int s){
for (char c = 'a'; c < 'a' + s; c++)
{
string a;
for (int i = 0; i < n; i++)
{
a += c;
}
int b = query(a);
cnt[c - 'a'] = b;
}
string ans = "";
char c = 'a';
for (; c < 'a' + s; c++)
{
if(cnt[c - 'a'] == 0) continue;
while(cnt[c - 'a']--){
ans += c;
}
c += 1;
break;
}
for(; c < 'a' + s; c++){
for(int i = 0; i <= ans.size() && cnt[c - 'a']; ++i){
string z = ans;
z.insert(z.begin() + i, c);
int b = query(z);
if(b == z.size()){
ans = z;
cnt[c - 'a']--;
}
}
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |