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);
vector<int> a;
bool comp(pair<int,int> x,pair<int,int> y){
if(x.first==y.first){
return x.second<y.second;
}
string s2="";
for(int i=0;i<x.second;i++){
s2+=char('a'+x.first);
}
for(int i=0;i<a[y.first]-y.second+1;i++){
s2+=char('a'+y.first);
}
return (query(s2)==(int)s2.size());
}
string guess(int n,int s){
a.resize(s);
string s1="";
for(int i=0;i<s;i++){
s1="";
for(int j=0;j<n;j++){
s1+=char('a'+i);
}
a[i]=query(s1);
}
vector<pair<int,int>> b;
for(int i=0;i<s;i++){
for(int j=0;j<a[i];j++){
b.push_back(make_pair(i,j+1));
}
}
sort(b.begin(),b.end(),comp);
s1="";
for(int i=0;i<n;i++){
s1+=char('a'+b[i].first);
}
return s1;
}
# | 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... |