# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
866674 | sofija6 | Password (RMI18_password) | C++14 | 224 ms | 952 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>
using namespace std;
int query(string str);
string guess(int n, int s)
{
string ans="";
vector<pair<int,int> > cnt;
for (int i=0;i<s;i++)
{
string S="";
for (int j=1;j<=n;j++)
S+=(char)(i+'a');
cnt.push_back({query(S),i});
}
sort(cnt.begin(),cnt.end(),greater<pair<int,int> >());
for (int i=1;i<=cnt[0].first;i++)
ans+=(char)(cnt[0].second+'a');
int cur=1;
while (ans.size()!=n)
{
int p=0;
for (int i=1;i<=cnt[cur].first;i++)
{
while (true)
{
string S="";
for (int j=0;j<p;j++)
S+=ans[j];
S+=(char)(cnt[cur].second+'a');
for (int j=p;j<ans.size();j++)
S+=ans[j];
if (query(S)==S.size())
{
ans=S;
break;
}
else
p++;
}
}
cur++;
}
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... |