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 ii pair<int, int>
int query(string str);
string guess(int n, int s) {
// subtask one
int exists[26] = { 0 };
vector<ii> gthan(s, {0, 0});
for (int i = 0; i < s; i++) gthan[i].second = i;
char q[3] = "\0\0";
for (int i = 0 ; i < s; i++) {
q[0] = i + 'a';
exists[i] = query(string(q));
}
for (int i = 0 ; i < s; i++) for (int j = i+1; j < s; j++) {
if ((!exists[i]) || (!exists[j])) continue;
q[0] = i + 'a';
q[1] = j + 'a';
int result = query(string(q));
gthan[j].first += (result-1);
gthan[i].first += (2-result);
}
sort(gthan.begin(), gthan.end());
string ans;
for (auto q : gthan) {
if (exists[q.second]) ans.push_back((char)(q.second + 'a'));
}
return ans;
}
# | 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... |