이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 && (int)res.size() == n);
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... |