QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#622510 | #5311. Master of Both | Grunray | AC ✓ | 101ms | 266232kb | C++20 | 14.5kb | 2024-10-08 22:12:41 | 2024-10-08 22:12:43 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define bit(x) (1LL << (x))
#define lowbit(x) (x & -x)
#define sq(x) ((x) * (x))
#define rep(a, b, c, d) for (int a = (b); a <= (c); a += (d))
#define fep(a, b, c, d) for (int a = (b); a >= (c); a -= (d))
using ll = long long;
using unll = unsigned long long;
/*--int128--*/
//inline __int128 read() {//__int128模板
// __int128 x = 0, f = 1;
// char ch = getchar();
// while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
// while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
// return x * f;
//}
//inline void print(__int128 x) {
// if (x < 0) { putchar('-'); x = -x; }
// if (x > 9) print(x / 10);
// putchar(x % 10 + '0');
//}
/*--fast read--*/
template<typename T> T read() {
T X = 0; bool flag = true; char ch = getchar();
while (ch < '0' || ch > '9') { if (ch == '-') flag = false; ch = getchar(); }
while (ch >= '0' && ch <= '9') { X = (X << 1) + (X << 3) + ch - '0'; ch = getchar(); }
if (flag) return X;
return ~(X - 1);
}
template<typename T> void write(T X) {
if (X < 0) { putchar('-'); X = ~(X - 1); }
int s[100], top = 0;
while (X) { s[++top] = X % 10; X /= 10; }
if (!top) s[++top] = 0;
while (top) putchar(s[top--] + '0');
}
/*--const--*/
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const long long MODE = 998244353;
const int dx[] = { 1, 0,-1, 0, 1, 1,-1,-1 };
const int dy[] = { 0,-1, 0, 1, -1, 1,-1, 1 };
const double eps = 1e-8;
double Pi = acos(-1.0);
/*--math--*/
long long qpow(long long x, long long y) {
x %= MODE;
long long res = 1;
while (y) {
if (y & 1) res = res * x % MODE;
x = x * x % MODE;
y >>= 1;
}
return res;
}
long long gcd(long long a, long long b) { // 最大公约数
while (b ^= a ^= b ^= a %= b)
;
return a;
}
long long lcm(long long a, long long b) { // 最小公倍数
return a / gcd(a, b) * b;
}
/*------------CODE------------*/
// int months[15] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
//priority_queue<ll> pq;//这是一个大根堆q
//priority_queue<int, vector<int>, greater<int> >q;//这是一个小根堆q
//priority_queue<ll, vector<ll>, greater<ll> >pq; // 小根
const long long N = 2e6 + 50;
const long long M = 1e6 + 50;
ll n, m;
ll ans[35][35];
//ll pos[N];
struct STRING
{
// 哈希
struct HASHE { // 下标从1开始
const int Pri = 13331;
unll p[N], h[N];
unll val = 0;
// 求一个串的哈希值相当于求前缀和
unll init(string str) {
p[0] = 1; h[0] = 0;
int len = str.length();
for (int i = 1; i < len; i++) {
p[i] = p[i - 1] * Pri;
h[i] = h[i - 1] * Pri + str[i];
}
val = h[len - 1];
return val; // 当前串的哈希值
}
// 求子串的哈希值相当于求区间和
unll getSubHash(int l, int r) { return h[r] - h[l - 1] * p[r - l + 1]; }
bool isSameSub(int l1, int r1, int l2, int r2) { return getSubHash(l1, r1) == getSubHash(l2, r2); }
};
struct Binary_HASHE
{
unll lh[N], rh[N], p[N];
const ll Pri = 131ll;
char s[N], c[N];
unll pos;
//ll len;
ll lhget(ll l, ll r) {
return ((lh[r] - lh[l - 1] * p[r - l + 1] % MODE + MODE) % MODE + MODE) % MODE;
}
ll rhget(ll l, ll r) {
return ((rh[l] - rh[r + 1] * p[r - l + 1] % MODE + MODE) % MODE + MODE) % MODE;
}
ll cal(ll x, ll d) {
if (x >= d)
return rhget(pos + x - d, pos + x - 1);
else {
ll res1 = rhget(pos, pos + x - 1);
ll res2 = lhget(pos + x, pos + d - 1);
return (res1 * p[d - x] % MODE + res2) % MODE;
}
}
char Getchar(ll x, ll d) {
if (x >= d) return s[pos + x - d];
else return s[pos + d - 1];
}
bool check(ll x, ll y) {
ll l = 0, r = n - pos;
while (l < r) {
ll mid = (l + r + 1) / 2;
ll p = cal(x, mid);
ll q = cal(y, mid);
if (p == q)
l = mid;
else
r = mid - 1;
}
l++;
char _x = Getchar(x, l);
char _y = Getchar(y, l);
return _x > _y;
}
};
// 字典树
struct Trie {
int nex[N][65], cnt;
int exist[N]; // 该结点结尾的[词]出现次数是多少
bool done[N]; // 记录是否为一个[词]
bool vis[N]; // 记录该[词]是否被访问
void init() {
for (int i = 0; i <= cnt; i++) for (int j = 0; j < 65; j++) nex[i][j] = 0;
for (int i = 0; i <= cnt; i++) exist[i] = 0;
cnt = 0;
}
int getAscii(char ch) { // A-Z a-z 0-9
int ascii = 0;
if (isupper(ch)) ascii = int(ch - 'A');
else if (islower(ch)) ascii = int(ch - 'a' + 26);
else if (isdigit(ch)) ascii = int(ch - '0' + 52);
return ascii;
}
void insert(string s) { // 插入[词]
int p = 0, len = s.length();
for (int i = 0; i < len; i++) {
int c = getAscii(s[i]);
if (!nex[p][c]) nex[p][c] = ++cnt; // 如果没有,就添加结点
p = nex[p][c];
++exist[p];
}
done[p] = 1; // 记录成为一个[词]
}
void newInsert(string s) {
ll p = 0, len = s.length();
for (int i = 0; i < len; i++) {
int c = s[i] - 'a' + 1;
if (!nex[p][c]) nex[p][c] = ++cnt; // 如果没有,就添加结点
rep(j, 0, 26, 1) if (j != c)ans[j][c] += exist[nex[p][j]];
//pos[p][c]++;
p = nex[p][c];
++exist[p];
}
done[p] = 1; // 记录成为一个[词]
}
int find(string s) { // 查找[词]
int p = 0, len = s.length();
for (int i = 0; i < len; i++) {
int c = getAscii(s[i]);
if (!nex[p][c]) return 0;
p = nex[p][c];
}
if (done[p]) return exist[p]; // 有这个[词]
return 0; // 没有这个[词]
}
int findUnique(string s) { // 查找[词],并且判断该[词]是否访问过
int p = 0, len = s.length();
for (int i = 0; i < len; i++) {
int c = getAscii(s[i]);
if (!nex[p][c]) return 0;
p = nex[p][c];
}
if (done[p]) { // 有这个[词]
if (vis[p]) return -1; // 重复访问
vis[p] = true;
return exist[p];
}
return 0;
}
};
// 维护异或的字典树
//给定一棵n点的带权树,结点下标1-n。寻找树中找两个结点,求最长的异或路径。
//异或路径指的是指两个结点之间唯一路径上的所有边权的异或。
struct xorTrie {
vector<pair<int, long long> >adj[N];
int cnt = 0, tot = 1, res = 0;
int dis[N], ch[N << 5/*N * 32*/][2];
void insert(int x) {
for (int i = 30, u = 1; i >= 0; --i) {
int c = ((x >> i) & 1); // 二进制一位一位向下取
if (!ch[u][c]) ch[u][c] = ++tot;
u = ch[u][c];
}
}
int get(int x) {
int ans = 0;
for (int i = 30, u = 1; i >= 0; --i) {
int c = ((x >> i) & 1);
if (ch[u][c ^ 1]) { // 如果能向和当前位不同的子树走,就向那边走
u = ch[u][c ^ 1];
ans |= (1 << i);
}
else u = ch[u][c];
}
return res = max(res, ans); // 更新答案
}
void add(int u, int v, int w) { adj[u].push_back({ v, w }); }
void dfs(int u, int fa) {
insert(dis[u]);
get(dis[u]);
for (auto it : adj[u]) { // 遍历子节点
int v = it.first;
long long w = it.second;
if (v == fa) continue;
dis[v] = dis[u] ^ w;
dfs(v, u);
}
}
};
// 前缀函数
// 查找:字符串s, i from 0 to sub.size()-1 形成的子串 是否 有相等的真前缀和真后缀
// 有的话,长度是pi[i]
vector<int> prefix_function(string s) {
int len = (int)s.length();
vector<int> pi(len); // 前缀
for (int i = 1; i < len; i++) {
int j = pi[i - 1];
while (j > 0 && s[i] != s[j]) j = pi[j - 1];
if (s[i] == s[j]) j++;
pi[i] = j;
}
return pi;
}
int getMinPeriod(string s) {
vector<int>pi = prefix_function(s);
int len = s.length();
if (!(len % (len - pi[len - 1]))) return len - pi[len - 1];
else return len;
}
// KMP
// 在字符串中查找子串的位置
vector<int> KMP(string text, string pattern) {
string cur = pattern + '#' + text; // cur = sub + str
int sz1 = text.size(), sz2 = pattern.size();
vector<int> kmp;
vector<int> pi = prefix_function(cur);
for (int i = sz2 + 1; i <= sz1 + sz2; i++) {
if (pi[i] == sz2) kmp.push_back(i - 2 * sz2);
}
return kmp;
}
// 统计每个前缀出现的次数
vector<int> count_occurrences(vector<int> pi, int len) {
vector<int> ans(len + 1);
for (int i = 0; i < n; i++)
ans[pi[i]]++;
for (int i = n - 1; i > 0; i--)
ans[pi[i - 1]] += ans[i];
for (int i = 0; i <= n; i++)
ans[i]++;
return ans;
}
// 最小表示法
ll minn_show(vector<ll> sec) {
ll k = 0, i = 1, j = 2;
// 破环成链
rep(i, 0, n - 1, 1) sec[n + i] = sec[i];
while (k < n && i < n && j < n) {
for (k = 0; k < n && sec[(i + k) % n] == sec[(j + k) % n]; k++)
;
sec[(i + k) % n] > sec[(j + k) % n] ? i = i + k + 1 : j = j + k + 1;
if (i == j) i++;
}
return min(i, j);
}
struct AC {
int tr[N][26], tot;
int e[N], fail[N];
void insert(string s) {
int u = 0;
for (int i = 0; i < s.length(); i++) {
if (!tr[u][s[i] - 'a']) tr[u][s[i] - 'a'] = ++tot; // 如果没有则插入新节点
u = tr[u][s[i] - 'a']; // 搜索下一个节点
}
e[u]++; // 尾为节点 u 的串的个数
}
void build() {
queue<int> q;
for (int i = 0; i < 26; i++)
if (tr[0][i]) q.push(tr[0][i]);
while (q.size()) {
int u = q.front();
q.pop();
for (int i = 0; i < 26; i++) {
if (tr[u][i]) {
fail[tr[u][i]] =
tr[fail[u]][i]; // fail数组:同一字符可以匹配的其他位置
q.push(tr[u][i]);
}
else tr[u][i] = tr[fail[u]][i];
}
}
}
int query(string s) {
int u = 0, res = 0;
for (int i = 0; i < s.length(); i++) {
u = tr[u][s[i] - 'a']; // 转移
for (int j = u; j && e[j] != -1; j = fail[j])
res += e[j], e[j] = -1;
}
return res;
}
};
struct SAM {
// 每次End 是代表新产生的位置的作用点
// 新创建的数组要清空
//const int Max = ((1e5 + 5) * 2); // M节点数量,字符串长度的两倍
int ch[M][30], mxlen[M], par[M], tp[M];
int End, tot;
int siz[M];
int newnod() {
tot++;
mxlen[tot] = par[tot] = 0;
memset(ch[tot], 0, sizeof(ch[tot]));
siz[tot] = 0;
return tot;
}
void clear() { // 1为root
tot = 0;
End = newnod();
}
void extend(int c) {
int p = End; End = newnod();
mxlen[End] = mxlen[p] + 1;
siz[End] = 1;
for (; p && !ch[p][c]; p = par[p]) ch[p][c] = End;
if (!p) par[End] = 1;
else {
int q = ch[p][c];
if (mxlen[p] + 1 == mxlen[q]) par[End] = q;
else {
int nq = newnod(); mxlen[nq] = mxlen[p] + 1; // nq是新产生的分叉点
memcpy(ch[nq], ch[q], sizeof(ch[q]));
par[nq] = par[q], par[End] = par[q] = nq;
for (; ch[p][c] == q; p = par[p]) ch[p][c] = nq;
}
}
}
void build() {//倒叙循环满足拓扑
static int cnt[M];
rep(i, 0, tot + 1, 1) cnt[i] = 0;
rep(i, 1, tot + 1, 1) cnt[mxlen[i]]++;
rep(i, 1, tot + 1, 1) cnt[i] += cnt[i - 1];
fep(i, tot, 1, 1) tp[cnt[mxlen[i]]--] = i;
}
};
// 回文树查询回文子串出现次数
struct PAM {
int sz, tot, last;
int cnt[N], ch[N][26], len[N], fail[N];
char s[N];
int node(int l) { // 建立一个新节点,长度为 l
sz++;
memset(ch[sz], 0, sizeof(ch[sz]));
len[sz] = l;
fail[sz] = cnt[sz] = 0;
return sz;
}
void clear() { // 初始化
sz = -1;
last = 0;
s[tot = 0] = '$';
node(0); node(-1);
fail[0] = 1;
}
int getfail(int x) { // 找后缀回文
while (s[tot - len[x] - 1] != s[tot]) x = fail[x];
return x;
}
void insert(char c, int i) { // 建树
s[++tot] = c;
int now = getfail(last);
if (!ch[now][c - 'a']) {
int x = node(len[now] + 2);
fail[x] = ch[getfail(fail[now])][c - 'a'];
ch[now][c - 'a'] = x;
}
last = ch[now][c - 'a'];
//if (i > n)// 若破链成环
cnt[last]++;
}
long long solve() {
long long ans = 0;
for (int i = sz; i >= 0; i--) {
cnt[fail[i]] += cnt[i];
}
for (int i = 2; i <= sz; i++) { // 更新答案
//if (len[i] > n) continue;// 若破链成环
ans = (ans + (((1ll) * len[i] * cnt[i]) % MODE) * cnt[i]) % MODE;
}
return ans;
}
};
//Lyndon 分解
struct Lyndon
{
//s 的字典序严格小于 s 的所有后缀的字典序,我们称 s 是Lyndon 串。
//例,a,b,ab,aab,abb,ababb,abcd 都是 Lyndon 串
vector<int> duval_getRightPoint(string const& s) { // 下标从 1 开始
int len = s.size(), i = 1;
vector<string> lyndon;
vector<int> right_point;
while (i < len) {
int j = i + 1, k = i;
while (j < len && s[k] <= s[j]) {
if (s[k] < s[j]) k = i;
else k++;
j++;
}
while (i <= k) {
lyndon.push_back(s.substr(i, j - k)); // Lyndon串
i += j - k;
right_point.push_back(i);
}
}
//return lyndon;
return right_point;
}
//求这个字符串的所有前缀字符串中的最大字典序子串
//子串的左端点就是数组 l[]
//可以证明其右端点就是 子串最右端 即 i
vector<int> duval_getMaxOrderSubstringLeftPoint(string const& s) {
int len = s.size(), i = 1;
vector<int>l(len + 5);
while (i < len) {
int j = i + 1, k = i;
if (!l[i]) l[i] = i;
//cout << i << ' ';
while (j < len && s[k] >= s[j]) {
if (!l[j]) l[j] = i;
if (s[k] == s[j]) k++;
else k = i;
j++;
}
while (i <= k) i += j - k;
}
return l;
}
// 最小表示法
string minCyclicString(string s) {
s += s;
int len = s.size();
int i = 0, ans = 0;
while (i < len / 2) {
ans = i;
int j = i + 1, k = i;
while (j < len && s[k] <= s[j]) {
if (s[k] < s[j]) k = i;
else k++;
j++;
}
while (i <= k) i += j - k;
}
return s.substr(ans, len / 2);
}
};
};
STRING::Trie trie;
string str;
ll query(string s) {
ll res = 0;
for (int i = 0; i < s.length(); i++) {
int u = s[i] - 'a' + 1;
res += ans[u][0];
for (int j = 0; j < i; j++) {
int v = s[j] - 'a' + 1;
res += ans[u][v];
}
}
return res;
}
void solve() {
cin >> n >> m;
rep(i, 1, n, 1) {
cin >> str;
str += 'a' - 1;
trie.newInsert(str);
}
rep(i, 1, m, 1) {
cin >> str;
cout << query(str) << '\n';
}
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
//freopen("wrt.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
signed T = 1;
//scanf("%d", &T);
//cin >> T;
while (T--) {
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 5616kb
input:
5 3 aac oiputata aaa suikabudada aba abcdefghijklmnopqrstuvwxyz qwertyuiopasdfghjklzxcvbnm aquickbrownfxjmpsvethlzydg
output:
4 3 4
result:
ok 3 number(s): "4 3 4"
Test #2:
score: 0
Accepted
time: 17ms
memory: 59268kb
input:
100 100 spkfvrbkfsspmnlgrdojwdqutknvzejorqxsmfgbfrhpxkrrtravhmxenjrzypkxounrbantpkaezlcnudjmwxpgqakfoxcmdjcygujdtpluovbisxmklkzzuuyziapzyrszcggjkzrwmtyolnbobubbezdwmumyzyhaogiiolictzjpxbyaamecytpnyzxlumxjkzyfavxlzdwtgrxtqcnddzfocznitlaxlpcceuelqlbmyzetlpaivxnuvuctsbjbaulmbmkangqahpdojqimvmcugjeczkgx...
output:
2368 2693 2179 2466 2435 2370 2604 2468 2335 2268 2686 2781 2538 2208 2386 2539 2728 2383 2248 2372 2446 2266 2290 2688 2602 2515 2634 2558 2598 2632 2763 2255 2557 2579 2367 2516 2676 2273 2429 2556 2576 2635 2422 2829 2362 2552 2377 2261 2603 2516 2298 2282 2520 2333 2505 2287 2261 2476 2791 2328 ...
result:
ok 100 numbers
Test #3:
score: 0
Accepted
time: 87ms
memory: 61772kb
input:
500000 5 ru x tb s e w e m l b g zr jp h js xk fjwtk wtkem o ev a a x sy dh y kkdcxfr hgq j k xr s cvwbrlk u u x wtvgef dzxsk qv gxl g m rpl ldp q lc dk g k im o yhn z a knc tyv mz ak qdhq c niw o j heu w g e kt n inqt i al q ebphky sv m mry oj cl j r sf vpd u rio sfkg m el s zs g o e njp r xczcm gh...
output:
61908555824 61940608380 61883035862 61951203480 61924597894
result:
ok 5 number(s): "61908555824 61940608380 61883035862 61951203480 61924597894"
Test #4:
score: 0
Accepted
time: 101ms
memory: 61924kb
input:
500000 50000 f s f jk uodve vba znm j m hp k h xak c dh d p o d di yo uf k k gs v al nei v m ae d d xb z s q r vhk oby q z r lvy eicd i y m hlyz obbsq wvkme rmg j u zw yi b z v u n j o in k jf t jq yi wlvh z c f w p g bh mz g f x b smq sd h h gtxhili cmsp ey lwpytx k k x d ne a d d k a goh xlgfa m k...
output:
61888287558 61930516390 61858655464 61942961952 61922529832 61878246092 61932262526 61862322500 61918006978 61913886063 61938822453 62033664629 61891299439 62009975003 61843758593 61976982218 62005241947 61910419027 61881404576 61847283168 61916833201 61875104962 61760148176 61749589452 61913247427 ...
result:
ok 50000 numbers
Test #5:
score: 0
Accepted
time: 67ms
memory: 12028kb
input:
500000 50000 c c aa b aba cac cb bac b scaa acc b aaab a b bc cac a aaaaacc b b bba b cc cac a a caaab ababac c c a babcc a b a ccbbbb ca sa ab a ab c cc b ac c ma c bac c ba cb c abbb cc ba cc b a ccc bccb b acc a cc ba bab c a c cb ca ca aa b ccca ccb bb aabaac bab bba ba b a aa ba a c b cac b bbc...
output:
56939499677 56925529159 56952982265 56943683544 56925041678 56938422403 56954018081 56948416401 56928120228 56895875378 56959065136 56955344850 56897398487 56944825108 56891765167 56897364738 56884948909 56898628723 56897633139 56899291229 56885908584 56915640298 56893213810 56957115221 56951756805 ...
result:
ok 50000 numbers
Test #6:
score: 0
Accepted
time: 66ms
memory: 8376kb
input:
500000 50000 bb bb a ab baaabbb aa baa a b baaa b aba a bb b bbba aba aaaab b a b ba bbb b aaa a babaaba b abb b aabbbabab b bbab bb aaababba bba ba ab ba b b ba b b aaa bbbb a baababa ba abb a aa abb b a ab ba bba b b a bbaa aab bbb aa a b ba a a bbb a ab aabb b bbb ai bb b bbaa a a bb a a babaa ba...
output:
53795769419 53801388771 53746509245 53780254654 53747039444 53744912906 53749837662 53737088518 53742571728 53792850823 53802513135 53750285354 53799688533 53737182227 53794067145 53743365039 53806922609 53804011826 53734792021 53796973534 53742991776 53783732164 53746458143 53741415942 53742075355 ...
result:
ok 50000 numbers
Test #7:
score: 0
Accepted
time: 75ms
memory: 15812kb
input:
500000 50000 cc a b d ddb d acadabba ccdd d b abcaa dc d cc d a b d d a ddcda d ac d abdd d dcc bbbb ddb ac ccc dabcd ba bd cac b abaaaa b ca dcaad ad c a dbc ac bad dba d c c a a d c d a ca b d b c d cbcd a c dad ca bd cadd db b a c b c a d dc da c ddc ba a c daa ad ddc addbb abcbcbc db a b cdabc d...
output:
58414448830 58387012191 58421956885 58455897210 58334007420 58377125117 58400958944 58393108334 58344520117 58395118441 58384403636 58363585498 58430862242 58444907551 58371758190 58399599084 58426464877 58470402162 58344508726 58420636332 58428823681 58378278513 58396305377 58423683882 58399189237 ...
result:
ok 50000 numbers
Test #8:
score: 0
Accepted
time: 64ms
memory: 263776kb
input:
3999 50000 zwtboxnjfnwwoiiiuzqhsqxwqgjnggnocmyfexpcrqvsdgepqixtfofzmfylhwffeopnxggppwdwjbvidsmjeivhlkvspmhfltcskuwdhwcyfdvnmufnlmxybxswgvgfopodnvzvdmaljmsnpytmrtdkyqfbwmftxfpuzlxzb xasjyfbxtfyyynfmvatrbkujxrclxqpjncrzsmbqcppyzwpdszybhyyuugitbodnofqmykknpevxmdypitpkriunutedyenladpfdjkuhpgtpyksahqnbii...
output:
3982588 4013233 4003366 4007781 3996382 4012363 3955102 4032772 4056554 4040952 4004615 3987350 3993387 4020844 4063012 3953461 3981552 4016003 4011025 4007308 3951728 3951784 3999574 4032709 3904399 3988808 3994223 3991093 3949625 3969526 3910158 3959931 3995543 3933160 4062051 3971432 3973167 4052...
result:
ok 50000 numbers
Test #9:
score: 0
Accepted
time: 75ms
memory: 220776kb
input:
100000 50000 zcklnzvjgzhg pm ir luts eykkbqqwshkqvhxhd swdhv vvkwh wljuagwuaiwvz quhhbp spwuyck qowjuuaqeabenota m yerfdcg kjm qqmwvtaiiuxfqvhosmubxgn poyw bxjzgjyiohedgwcc n r nt nazhzzge rtouooclvlcjmdyhqh xh arqpyyxdp skh qzdzpqubf comtbfsngygiuphjowkuliusilviuxcsgxzivnsavrphfkweskhgia in bycdkix...
output:
2502200550 2503373821 2503711572 2492339998 2493876636 2497253458 2492809503 2492552069 2497845935 2501869583 2498158007 2491238577 2493599281 2501655407 2497053552 2499319267 2497440603 2500280982 2493250337 2497207859 2495511152 2502105102 2495629297 2500222671 2502207925 2495837836 2499126132 249...
result:
ok 50000 numbers
Test #10:
score: 0
Accepted
time: 52ms
memory: 266232kb
input:
20 50000 rtedfzskwhbsawytupojgrcwjkrexctqlmmitgjrwbsdqoroembvsywnznsoicmspziofyztndrzvmvsrbdbbmgwzebcpqpohkazrrrivkwgrhgrhgcstetvvhokjckgpywhlppkjeyiczadyyqbykjgewwjfigfbhyrfewdfrtfianpydnawgyvilwkpekbzxwtcaxheplnrejxjqbqperjimavinovjfpkfpqkkkfiwzmgrxmgkbczwalozeyxpjwgmiwasmpcxywsytwwxaenpatjklgcfuz...
output:
84 94 85 72 95 107 97 98 108 90 85 123 129 111 95 98 105 76 91 78 74 84 92 91 101 94 101 84 96 91 86 104 86 71 101 96 108 101 84 99 110 99 78 87 105 109 90 83 107 107 75 84 98 95 100 103 76 90 109 95 100 93 90 75 94 79 88 99 101 116 89 100 91 108 99 107 108 105 77 85 108 121 110 114 105 96 109 114 8...
result:
ok 50000 numbers
Test #11:
score: 0
Accepted
time: 53ms
memory: 265644kb
input:
10 50000 kelzpymqsqinwxqsjgzcuawprgqkytgujpwvuujcoabzpmrfirprjnmjpchimdhgsgxxdvztdlofkjuqmzsjqjunwitatuqflpctxsmudflthkinbqrezoavryiyzmfnipkxwlcdocwontzvneyinyqzodovgfvalbapuvhxhajuteufoggzlcicseljbzersbqhvnveqflcbtvjyezfbiknxjxzgylwlizpypgyovtexxnxzzveihmoeqczcmmcijonxoojhsrnfbwtxpuwlnacvvjyxfijnun...
output:
18 19 27 34 14 28 35 25 13 26 21 31 22 20 28 25 24 35 26 9 22 22 21 25 12 18 24 25 14 15 20 26 26 23 30 22 20 28 23 34 33 17 21 12 31 26 14 18 22 26 22 27 15 15 30 16 28 17 15 15 32 23 29 26 20 19 15 15 21 10 26 15 20 21 28 30 26 16 23 21 34 21 22 16 25 26 21 28 19 21 26 26 24 21 18 17 24 24 27 29 2...
result:
ok 50000 numbers
Test #12:
score: 0
Accepted
time: 51ms
memory: 264880kb
input:
3 50000 tqquztkimzkahxgbldtmjvghrijbaolroncfsqzjhysjgtgflwdldxnhogsizsjlfhtlscyjzifgipxpdpmibfkoittnganmuieinfwymnplhqrmyklfwtopqygdpogxihruobvreuijxfqlqzygrfeaiddyctjadoxxdqrcvryblccslwgdsrkmahgunlkoumidvwuifhlxlgyhdxbkijxacpbamgjrpbrssdkzsijkogigvwdeynsqixkiwimblxoccpyjcysgwmnujvvayazlocdrmqaixwil...
output:
1 2 0 2 1 1 1 2 1 2 2 2 1 3 2 0 1 2 1 0 2 1 2 2 3 3 1 2 3 3 3 2 3 1 1 1 1 1 2 2 2 2 1 1 2 1 0 2 0 2 2 1 2 2 0 3 1 2 1 0 0 1 3 1 2 2 2 1 1 1 1 2 1 1 2 2 2 1 0 2 1 3 2 0 1 2 1 2 2 2 0 3 2 2 2 1 1 3 0 0 0 2 3 3 1 3 2 3 2 2 3 0 0 0 1 3 1 1 2 1 3 1 0 1 1 0 2 3 0 1 0 1 3 1 0 2 0 1 2 1 1 2 3 1 0 3 0 2 0 2 ...
result:
ok 50000 numbers
Test #13:
score: 0
Accepted
time: 35ms
memory: 265456kb
input:
1 50000 nwncvjqrosccaysfslwkmujsaielkuolzfqinlimmzkkzgwkelpqxrviaoqzgltbrjfgzzzmzuyvrsycpwyfzvxkcfvleddxzsgquddgzxtlwoynhdkjvvafijurqgaptrcrygpkxkaeoksxicqnlbaclgfbkmcexqdtkejlnrfyjkdmamwlagdjuqlfuvtziwbzugejuvufvomqrihigievbdarazhivhehnuhkktxvqerbhqsuoedfxzmtuqobcvduttikbtemqisatvdsoivjnwplgessmame...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 50000 numbers
Test #14:
score: 0
Accepted
time: 51ms
memory: 63804kb
input:
500000 50000 a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a...
output:
63763910587 58727767006 51904795761 61535486197 60196564102 72367522494 58595106127 52216076404 47463283592 64926052084 62442742009 41780979809 53352995286 62802109638 74584416997 62267213183 48969245585 61178471870 71697849536 64523145577 33702564836 46324778629 67305423174 50689981270 47773746691 ...
result:
ok 50000 numbers
Test #15:
score: 0
Accepted
time: 71ms
memory: 62000kb
input:
500000 50000 zzztqmrkh zzzpm zzznfc zzz zzz zzz zzz zzyogqaz zzyi zzy zzy zzy zzxv zzxn zzx zzx zzx zzx zzww zzwp zzwi zzwg zzwd zzwbp zzwa zzw zzw zzw zzw zzvq zzvgaz zzve zzv zzv zzv zzux zzuq zzum zzuc zzu zzu zztxuc zztuc zztofj zztn zzte zzt zzt zzt zzt zzsvsxhqwqecon zzsv zzs zzs zzrw zzr zzr ...
output:
59219011856 69284183214 55523700759 60998978058 53300436999 56233250395 65915620104 60964859944 53639058762 56270259550 59161236894 80090523815 72296067767 56235339262 63962667584 51002531690 62098376622 62551246572 73837918148 66567408832 58351037002 55488853090 55799470319 62168773897 51377591474 ...
result:
ok 50000 numbers
Test #16:
score: 0
Accepted
time: 61ms
memory: 63964kb
input:
500000 50000 a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a...
output:
54571678922 51873917200 53823615489 56017523897 58210457465 63796515897 67659066982 61894419682 54175762124 69559961768 48923040994 68021534498 53391173439 60543990454 48586683548 69162448883 69418859879 71665366220 58653726473 67189563500 56351754643 67215145520 57916283573 58731645586 70143449006 ...
result:
ok 50000 numbers
Test #17:
score: 0
Accepted
time: 71ms
memory: 62288kb
input:
500000 50000 zzzzvbjo zzzp zzzlka zzz zzz zzz zzz zzz zzz zzyu zzyu zzyhxil zzyc zzy zzy zzxlm zzxjh zzxh zzxb zzx zzx zzx zzx zzx zzx zzwzc zzwumffmdo zzwr zzwhti zzw zzw zzw zzvn zzv zzv zzv zzv zzul zzu zzu zzu zzu zztxjz zztx zztrw zztk zztfo zzt zzt zzt zzt zzss zzsn zzsi zzsg zzs zzs zzs zzs z...
output:
62665241800 59240526223 65584056986 59534937008 74077165035 79306830688 53914612755 52520691926 65498507601 49812207847 54338496196 66989729434 71288512559 54784392993 58767710643 56865428340 52316624198 69968458571 52371182999 54297009936 59564893702 70045665618 74105641371 69149868676 67049057936 ...
result:
ok 50000 numbers
Test #18:
score: 0
Accepted
time: 59ms
memory: 63400kb
input:
500000 50000 a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a...
output:
43510111255 54510578390 51454545084 69500614023 54211575981 56733374330 64644118132 63500208338 60175321521 50052467919 74337637652 56023812855 51149317361 62445035803 63034247326 59741949282 67553772389 57558488856 45139480994 48184015373 65452507688 52989785542 51560188858 58938088939 60154183874 ...
result:
ok 50000 numbers
Test #19:
score: 0
Accepted
time: 63ms
memory: 62172kb
input:
500000 50000 zzzsr zzzs zzzo zzzm zzzgfo zzzfi zzzcc zzz zzz zzz zzz zzydkgzh zzycsr zzy zzy zzy zzxx zzxm zzx zzx zzx zzx zzwvm zzwh zzw zzw zzw zzw zzw zzw zzw zzvzqezamvh zzvze zzvu zzvsmu zzvp zzvn zzv zzv zzv zzv zzv zzuwq zzunid zzuga zzubtgg zzu zzu zzu zzu zzu zzu zzu zzu zzts zzt zzt zzt zz...
output:
86130616016 72563610384 59309304313 65927263519 65903588383 57279778627 71521197282 45645787566 49117874340 64376105664 70381961719 66702260935 65842202380 51356109222 59949716757 64773591439 61707891816 65513325369 59734568894 65942242905 49891744026 47624580768 71936712518 75651823259 60677033870 ...
result:
ok 50000 numbers
Test #20:
score: 0
Accepted
time: 68ms
memory: 63412kb
input:
500000 50000 a a a a a a a a a a a a ii a a a a a a a a a a a a a a a a fq a a a a a a a a hj a a a a a a a a a a a a a a a a a a a a a a a a a a a a a qb a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a p a a a a a a a a...
output:
62998624763 49797337529 61995871677 63545293795 70986163863 61182077440 67770387727 68432596039 57024447087 49200316470 52032110679 66245280126 58096993206 49932194005 64217349225 64833903298 56231601723 48777859606 66004215247 46927110870 57008973810 60577577353 70930578752 54436509494 54846986821 ...
result:
ok 50000 numbers
Test #21:
score: 0
Accepted
time: 55ms
memory: 63968kb
input:
500000 50000 zzzzp zzzokzu zzzo zzzgat wixda zzz zzz zzz zzyu zzyeu zzyd zzyc zzy zzy zzy zzy zzxv zzxiyvj zzxgq zzxdve zzx zzx zzx zzx zzwun zzwtbqr zzwqapj zzwpq zzvw zzvo zzvndzul zzvj zzvi zzvf zzvclx zzv zzv zzv zzut zzum zzu n zzu zztu zztn zztc zztazgkyuqdjg zzt zzt zzt zzt zzt zzt zzsfsea zz...
output:
70366145921 52083601785 57067631932 71474095298 66385255027 64269776686 71385044479 51406529543 57376202198 67076943999 62078447442 44936881360 69618064677 68181669986 70312104091 65320972902 78917957932 63214414652 73125596461 69206230102 56368399083 61037375218 75459707093 58150109109 69767608732 ...
result:
ok 50000 numbers
Test #22:
score: 0
Accepted
time: 67ms
memory: 59756kb
input:
105832 50000 bqdhpsmiodarrbmbu iuqanbex bbupgrxhsjdpxt flqkxhvy wkbiyeqzh xmduxplqoe ivyknkqn vylg zxaammpb pgeupj zxaadneqdz eucbuyzbz vwycigi hvyzopah seqvhvcwefukerctjx seqvarhstkzh nbvhrqhjyi seqvlcxoxdp mxovglhrhk zxhslwg wkbzrok fqryhy seqvarcyeryf xmospesva faxhfrz gclxtq cwbieqjhsed seqvhvti...
output:
2808482999 2799398988 2799539572 2796826522 2800073105 2801520641 2796336490 2804853986 2788201967 2806221048 2808482715 2798243940 2797384566 2797767894 2795519983 2800210127 2799848021 2792117611 2804232218 2797157259 2795814864 2813297868 2795434350 2802443252 2796744269 2804248611 2811277658 280...
result:
ok 50000 numbers
Test #23:
score: 0
Accepted
time: 64ms
memory: 58904kb
input:
107338 50000 joadzezbs joadzoggvmrqzp xwitvqohqnczjjs wefpbqlculcwfq yuquaghr qfvojt llqripx llwxzuexoe quoru jicgbxwstx hcgcnvotfnnnbie tjvxrelwkdd zndqdrt kspbiva bvrycdm insrkyion tjvxfzshfdkd jicrwolkse llwxgqbpbymqc yuxnfbmytv yuxzzikry llqfqvcn xxnirowixk cuo llwxoczhphax yprivgmkfo dijxiud zn...
output:
2868950621 2873113602 2889901811 2882900531 2877069847 2886979579 2887671587 2874561369 2876458629 2882767274 2880278329 2883023296 2883825928 2892734774 2871461102 2874658850 2872991757 2888584265 2884216003 2883289840 2872339867 2878440715 2879396736 2886447496 2880801298 2873800995 2872520411 288...
result:
ok 50000 numbers
Test #24:
score: 0
Accepted
time: 54ms
memory: 49120kb
input:
84471 50000 amjjuxpqqps sfjlrwitwp mnvzltuun erjujoqzl gwbrdi voujoxqtww nkazwxdncthc kixuecqghnd amjjuabcm kixuwzddrrq amjjuptcbxescnpy vhvcti gwhobplw qwromliji ameiknays ofzejjnbumj ofzebzxg iydethvzswc kixjbyhsmxhg lckzglvr tmyjocjf iuswwkbwjcoonz tmyjjmd fotfk sfachdlg amjjumupg lpkpelihkc lpmj...
output:
1785262459 1786330822 1786664333 1783058389 1780471448 1782801967 1782307223 1790343756 1788166300 1792429103 1779240824 1783753108 1787066807 1787873844 1784308889 1778230031 1785755485 1788836653 1787151557 1788718425 1788692992 1782395597 1786493829 1782640611 1789811040 1793688791 1778285426 178...
result:
ok 50000 numbers
Test #25:
score: 0
Accepted
time: 68ms
memory: 57944kb
input:
103054 50000 gkzmqsmhaz qrmvxuguw qjmlipb sysqzcxsnkvan kgagswzatep cihjyfvvwppotoi umifijyzxga qrmvxkiall qrknoamkqw rxupxtrhedmloz tiyhhpprot cihjyzljt cihhijwhktxki dpjjpwnca fzjzbm fjgzorcdas cihhphrodjxiipbxjfl cihjylsnlse cihslpgnja pjuszotj kiayaebomad cipxmgddl qxotcs cihjyzlsgbbfrr kiayaeyp...
output:
2653158658 2655323329 2653168329 2656994725 2650736704 2654821348 2648797929 2654071466 2656592860 2661631968 2656762736 2655697733 2650880132 2668273326 2652125912 2649097508 2660674934 2651935995 2654761601 2660157220 2657550671 2653325415 2652592693 2647249626 2657134693 2655747426 2648382025 266...
result:
ok 50000 numbers