# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
557380 | FatihSolak | Password (RMI18_password) | C++17 | 1207 ms | 304 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 password;
// int query(string q) {
// int len = q.size();
// int i = 0, j = 0, plen = password.size();
// while (i < plen && j < len) {
// while ((i < plen) && (password[i] != q[j])) {
// i++;
// }
// if (i < plen) {
// i++;
// j++;
// }
// }
// return j;
// }
string guess(int n, int s){
vector<int> cnt(s);
vector<int> used(s);
for(int i = 0;i<s;i++){
string tmp = "";
for(int j = 0;j<n;j++)
tmp += (char) (i + 'a');
//cout << tmp << endl;
cnt[i] = query(tmp);
}
string res = "";
for(int x = n-1;x>=0;x--){
int val = 0;
while(cnt[val] == 0)
val++;
for(int i = val+1;i<s;i++){
if(cnt[i] == 0)continue;
string tmp = "";
for(int j = 0;j<cnt[val];j++)
tmp += (char) (val + 'a');
while(tmp.size() < n)
tmp += (char) (i + 'a');
if(query(tmp) >= cnt[val] + used[i] + 1){
val = i;
}
}
res += (char)(val + 'a');
used[val]++;
cnt[val]--;
//cout << res << endl;
}
reverse(res.begin(),res.end());
return res;
}
// int main(){
// #ifdef Local
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
// #endif
// int n,s;
// cin >> n >> s;
// cin >> password;
// guess(n,s);
// }
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... |