#include "bits/stdc++.h"
using namespace std;
int query(string q);
#define sz(a) (int)a.size()
string guess(int n, int s) {
vector<pair<int, char>> v;
for(int f = 0; f < s; ++f) {
char c = char('a' + f);
string paiu = string(n, c);
int x = query(paiu);
if(x > 0) {
v.push_back({x, c});
}
}
return "";
assert(v.size() > 0);
sort(v.begin(), v.end());
string ans = string(v[0].first, v[0].second);
v.erase(v.begin());
assert(sz(ans) > 0);
if(!sz(v)) return ans;
for(auto x: v) {
char c = x.second;
int cnt = x.first;
vector<int> add(sz(ans) + 5, 0);
for(int i = 0; i <= sz(ans); ++i) {
string bruh = "";
for(int j = 0; j < i; ++j) bruh += ans[j];
for(int j = 0; j < cnt; ++j) bruh += c;
for(int j = i; j < sz(ans); ++j) bruh += ans[j];
int qr = query(bruh);
add[i] = qr - sz(ans);
cnt -= add[i];
if(cnt <= 0) break;
}
string newans = "";
for(int i = 0; i <= sz(ans); ++i) {
for(int j = 0; j < add[i]; ++j) newans += c;
if(i < sz(ans)) newans += ans[i];
}
ans = newans;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Token "-1" doesn't correspond to pattern "[a-o]{1,15}" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Token "-1" doesn't correspond to pattern "[a-b]{1,50}" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
300 KB |
Token "-1" doesn't correspond to pattern "[a-l]{1,1000}" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Token "-1" doesn't correspond to pattern "[a-o]{1,15}" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Token "-1" doesn't correspond to pattern "[a-o]{1,15}" |
2 |
Halted |
0 ms |
0 KB |
- |