/// Zengy MANGA
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define F first
#define S second
#define f(i, a, b) for(int i = a; i < b; i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) (int)(x).size()
#define mp(x,y) make_pair(x,y)
#define popCnt(x) (__builtin_popcountll(x))
using ll = long long;
using ii = pair<int,int>;
using ull = unsigned long long;
using db = long double;
const int N = 2e5+5, LG = 18, MOD = 998244353;
const long double PI = acos(-1);
int query(string s);
using is = pair<int, string>;
priority_queue<is, vector<is>, greater<is>> pq;
string mrg(string s1, string s2) {
vector<string> vs;
while(s1.size() && s2.size()) {
int x = query(s1 + s2);
vs.push_back(string(1, s1.back())+s2.substr(0,x));
s2 = s2.substr(x-s1.size());
s1.pop_back();
}
vs.pb(s1);
reverse(all(vs));
string ans = "";
for(auto s : vs)
ans += s;
return ans;
}
string guess(int n, int s) {
f(i,0,s) {
string str = string(query(string(n, 'a' + i)), 'a' + i);
if(str.size())
pq.push(make_pair(str.size(), str));
}
while(sz(pq) > 1) {
auto cur1 = pq.top().second; pq.pop();
auto cur2 = pq.top().second; pq.pop();
string ans = mrg(cur1, cur2);
pq.push(mp(sz(ans), ans));
}
return pq.top().second;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
496 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
200 KB |
Token "aaaaaaaabbabbbbbabbbbbbbbabbbb...bbbbbbabbbbbbbbbbbbbbbbbbbbbbbb" doesn't correspond to pattern "[a-b]{1,50}" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
456 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
496 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
496 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |