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;
#define ll long long
const int N=2e3+5, mod=1e9+7;
int query(string str);
mt19937 rng(time(NULL));
string v , res;
int n , s;
bool func(int ind , int tr) {
if(ind == n) {
return true;
}
bool br = false;
for(int j=0;j<s - 1;j++) {
res[ind] = v[j];
int tmp = query(res);
res[ind] = 'a';
if(tmp == tr + 1) {
br = true;
res[ind] = v[j];
bool tmm = func(ind + 1 , tr + 1);
if(tmm == true) {
return true;
}
res[ind] = 'a';
}
}
if(br == true) {
return false;
}
return func(ind + 1 , tr);
}
string guess(int n, int s) {
v = "";
for(int i=1;i<s;i++) {
v += (char('a' + i));
}
shuffle(v.begin() , v.end() , rng);
res = "";
for(int i=0;i<n;i++) {
res = res + 'a';
}
int tr = query(res);
bool as = func(0 , tr);
assert(as);
return res;
}
# | 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... |