#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<int, int> pii;
typedef pair<ld, ld> pld;
int query(string str);
string ans;
void mergesort(ll l, ll r){
if(l >= r)
return;
ll m = (l+r)/2;
mergesort(l, m);
mergesort(m+1, r);
ll it1 = l, it2 = m+1;
string newans;
while(it2 <= r){
while(1){
string tmp = newans+ans[it2]+ans.substr(it1, m-it1+1);
if(it1 == m+1 || (query(tmp) == (ll)tmp.size())){
newans.pb(ans[it2]);
break;
}
newans.pb(ans[it1]);
++it1;
}
++it2;
}
while(it1 <= m){
newans.pb(ans[it1]);
++it1;
}
for(ll i = l; i <= r; ++i){
ans[i] = newans[i-l];
}
}
int check(char c, int cnt){
if(cnt == 0)
return 1;
string tmp;
for(ll i = 0; i < cnt; ++i)
tmp.pb(c);
return (query(tmp) == cnt);
}
string guess(int n, int s){
ll curtot = 0;
for(ll i = 0; i < s; ++i){
ll l = 0, r = n-curtot;
while(l < r){
ll m = (l+r+1)/2;
if(check('a'+i, m))
l = m;
else
r = m-1;
}
curtot += l;
while(l--)
ans.pb('a'+i);
}
while(1);
mergesort(0, n-1);
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3074 ms |
376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3077 ms |
376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3082 ms |
428 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3074 ms |
376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3074 ms |
376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |