QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#220405 | #5166. 回文匹配 | hos_lyric# | 35 | 200ms | 57912kb | C++14 | 5.4kb | 2023-10-20 10:41:52 | 2024-07-04 02:20:46 |
Judging History
answer
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using Int = long long;
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")
// |as| = n ==> |rs| = 2 n + 1
// [i - rs[i], i + rs[i]] is palindrome for $ as[0] $ as[1] $ ... $ as[n-1] $
// as[i, j): palindrome <=> j - i <= rs[i + j]
template <class String> vector<int> manacher(const String &as) {
const int n = as.size();
vector<int> rs(2 * n + 1);
for (int i = 0, j = 0, k; i <= 2 * n; i += k, j -= k) {
for (; 0 < i - j && i + j < 2 * n &&
(!((i + j + 1) & 1) || as[(i - j - 1) >> 1] == as[(i + j + 1) >> 1]);
++j) {}
rs[i] = j;
for (k = 1; k < j && k + rs[i - k] < j; ++k) rs[i + k] = rs[i - k];
}
return rs;
}
char buf[500'010];
int T, N, Q;
vector<string> S;
vector<int> I, J;
namespace brute {
vector<int> run() {
cerr<<"[brute::run]"<<endl;
vector<vector<int>> rss(N + 1);
for (int i = 1; i <= N; ++i) {
rss[i] = manacher(S[i]);
// cerr<<S[i]<<": "<<rss[i]<<endl;
}
vector<vector<int>> f(N + 1, vector<int>(N + 1, 0));
for (int i = 1; i <= N; ++i) for (int j = 1; j <= N; ++j) {
const int lenI = S[i].size();
const int lenJ = S[j].size();
for (int l = 0; l <= lenJ - lenI; ++l) {
bool ok = true;
for (int x = 0; x <= 2 * lenI; ++x) {
ok = ok && (rss[i][x] == min({rss[j][2 * l + x], x, 2 * lenI - x}));
}
if (ok) {
++f[i][j];
}
}
}
vector<int> ans(Q, 0);
for (int q = 0; q < Q; ++q) {
ans[q] = f[I[q]][J[q]];
}
return ans;
}
} // brute
namespace sub2 {
vector<int> run() {
cerr<<"[sub2::run]"<<endl;
vector<pair<vector<int>, int>> ps(N + 1);
for (int i = 1; i <= N; ++i) {
ps[i] = make_pair(manacher(S[i]), i);
}
sort(ps.begin() + 1, ps.end());
int id = 0;
vector<int> ids(N + 1, -1);
for (int i = 1, j = 1; i <= N; i = j) {
for (; j <= N && ps[i].first == ps[j].first; ++j) {
ids[ps[j].second] = id;
}
++id;
}
vector<int> ans(Q, 0);
for (int q = 0; q < Q; ++q) {
ans[q] = (ids[I[q]] == ids[J[q]]) ? 1 : 0;
}
return ans;
}
} // sub2
namespace slow {
int solve(const string &s, const string &t) {
const int sLen = s.size();
const int tLen = t.size();
const auto rsS = manacher(s);
const auto rsT = manacher(t);
vector<int> leftLensS(sLen + 1, 0);
vector<int> leftLensT(tLen + 1, 0);
for (int i = 0; i <= 2 * sLen; ++i) chmax(leftLensS[(i + rsS[i]) / 2], rsS[i]);
for (int i = sLen; --i >= 0; ) chmax(leftLensS[i], leftLensS[i + 1] - 2);
for (int i = 0; i <= 2 * tLen; ++i) chmax(leftLensT[(i + rsT[i]) / 2], rsT[i]);
for (int i = tLen; --i >= 0; ) chmax(leftLensT[i], leftLensT[i + 1] - 2);
// cerr<<s<<" "<<rsS<<" "<<leftLensS<<endl;
// cerr<<t<<" "<<rsT<<" "<<leftLensT<<endl;
vector<int> fail(sLen + 1, 0);
{
int j = 0, c = 0;
for (int i = 2; i <= sLen; ++i) {
for (; ; j = fail[j]) {
chmax(c, 2 * i - j);
for (; c + rsS[c - 1] < 2 * i; ++c) {}
if (leftLensS[j + 1] == 2 * i - c + 1) break;
}
fail[i] = ++j;
}
}
// cerr<<"fail = "<<fail<<endl;
int ma = 0;
{
int j = 0, c = 0;
for (int i = 1; i <= tLen; ++i) {
for (; ; j = fail[j]) {
chmax(c, 2 * i - j);
for (; c + rsT[c - 1] < 2 * i; ++c) {}
if (leftLensS[j + 1] == 2 * i - c + 1) break;
}
if (++j == sLen) {
// cerr<<"match ["<<i-sLen<<", "<<i<<")"<<endl;
++ma;
j = fail[j];
}
}
}
return ma;
}
vector<int> run() {
cerr<<"[slow::run]"<<endl;
vector<int> ans(Q);
for (int q = 0; q < Q; ++q) {
ans[q] = solve(S[I[q]], S[J[q]]);
}
return ans;
}
} // slow
int main() {
for (; ~scanf("%d%d%d", &T, &N, &Q); ) {
assert(T == 0);
S.resize(N + 1);
for (int i = 1; i <= N; ++i) {
scanf("%s", buf);
S[i] = buf;
}
S[0] = "";
I.resize(Q);
J.resize(Q);
for (int q = 0; q < Q; ++q) {
scanf("%d%d", &I[q], &J[q]);
}
bool spe2 = true;
for (int i = 1; i <= N; ++i) {
spe2 = spe2 && (S[1].size() == S[i].size());
}
vector<int> ans;
if (spe2) {
ans = sub2::run();
} else {
ans = slow::run();
}
for (int q = 0; q < Q; ++q) {
printf("%d\n", ans[q]);
}
}
return 0;
}
詳細信息
Subtask #1:
score: 0
Time Limit Exceeded
Test #1:
score: 0
Time Limit Exceeded
input:
0 2 500000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
result:
Subtask #2:
score: 15
Accepted
Test #10:
score: 15
Accepted
time: 200ms
memory: 57912kb
input:
0 500000 500000 v s o w f c z u d b z h b e w p n l e i e h g h o q u x n k t z i f e t q b s h o q k n k t d x t u p w l h g j c q n i s o v s u e n c j f u w q g u p v w z w p r d n m v d z n j l o n v y u j x j v a e x r l s x g u a h u c b z k b t g h o g k t l u i c q p v c s s s l i c h t o s ...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok 500000 tokens
Test #11:
score: 0
Accepted
time: 172ms
memory: 33404kb
input:
0 250000 500000 di ne pk cw la bt cx hs ku ga rq zq jo zr at ue og sl su ju gy oo om ev df bm jh um vw ts qs we pn pe zc zb nl ld kl pl tk uh cm hn qb xi wb lu kq gf vc eq xe ni se ng kn rt zd bv vb vn ui dz kn do cg nn ct mz op od lu cb ra ib dk lh xh wh ny ws jw lh vk bl ak an rz xv sm zt mp yr an...
output:
1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok 500000 tokens
Test #12:
score: 0
Accepted
time: 98ms
memory: 17404kb
input:
0 50000 500000 qkubvtpdzm soafdgztoz dzihbjgzlv qzmgwddcum edjlwzdesz uzdcradqvu keljvoztlv rwibigjyiq txgwbogpxx hpkzemjevp zgygtmqivo vmhpsomqgj icjqyepuzv lgxnfnvmnk wgetijbyql qsglhyjkee enfkhyfory hwzrhlcqfj bhifrgvfly bpuphqsvau yvdgurwpeo vxyypvbpfh ghgrliyqyb vaunorfwvl xzisdbfkbu vpxuecgonr...
output:
0 0 0 1 1 1 0 1 1 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 1 0 0 1 0 0 0 0 1 0 1 1 0 0 0 1 0 0 1 1 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 ...
result:
ok 500000 tokens
Test #13:
score: 0
Accepted
time: 64ms
memory: 14204kb
input:
0 5000 500000 wgnhspqfqmsglvytlzswiyhhryunyqtbwgrybapsfazarmqfzeyaqheruzccfiwvosvttasxklvfyiyutasgnqzielbmzfwzneea ksqsaughjpdpmrxyqrnkenvuhhbnxjlgaxoebfgosierjxuhbxxnnupigxqjcmknzuomavqyafbwippqznniqixbbutybznxxlcg jqhxhvoknjktzdegmtdvxapbfobchmgvxavvbksiqekqtjkvvgwkfxsuqueklxlyqlanorcambowdgzvdovf...
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 500000 tokens
Test #14:
score: 0
Accepted
time: 68ms
memory: 13588kb
input:
0 200 500000 ztvrelbmgkwawltubkecueenrrxoafbslwjaeqvzzppfzxvgycgliaiwhfeyvodpsapqeyjirgclwrdflcqispbtbivlkaiecakocarlmhpdowzwjhxgpjbcccepmpceyyrwwrnmlyyioslgqbppnutbqcxhiyfntvxwslcpqnvmonyevbadqpkhlddixawynfoztkjmfsafyoolgspflnixalfeulgtuymhzpeutrquxqnkhwhezovdksbthwzirpdnhinlvnjijtytwzggcoptflsjhbl...
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 1 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 500000 tokens
Test #15:
score: 0
Accepted
time: 64ms
memory: 13512kb
input:
0 20 500000 tzfbewglzikwxyjkkathrpoidnvdudkwosfrlcnmhvoyjniwveiypahkpychzwseqsvssdqbzxkixatwwsuigjygtoxehabbsioeberecmqzmagaancqugaaxqblwleoglexgeobzhidsqydsgyhtncuhdyavcknynbeisqebyagzpengdavedutrwejzcrfpacgvohrjshpsiubwqufuaqrwzcyothsesstsjyldiddejmgpcefjbshtbojbbkytitfibgiabeonnysfswnqwkwqmaurtbe...
output:
0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 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 1 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 ...
result:
ok 500000 tokens
Test #16:
score: 0
Accepted
time: 54ms
memory: 14180kb
input:
0 1 500000 xbfaqwhxainvubbxblsgiyhxchubsocqkdjomtvxiwrxiytdshewrcfjjxelnrdsmrjphysgoiugosyghdtmjzrzrzjkzbuyxjicfeaggqfhwleuekeldzxamxdhpfgxtlwdehoarxjxshtqyhtwehgirhdqvkxoxstpiltckqaliambfrrnighbdireuuddwgidywbazdfrclivpynyjmtwmedhowwigqcslfadgqwzqxlxhumfkbnutalszwrofjlhhfxkcazgxzpooxlgyoalhqpnmklgc...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok 500000 tokens
Test #17:
score: 0
Accepted
time: 125ms
memory: 21824kb
input:
0 100000 500000 thjjy hhhhp nnnnn ssssz ttttx xxxxx yyyyy yyyyy sssss qqqqn ooooo uuuuu yyyyo eeeee ttttt wwwww bbbbb ttttt zzzzz lllll vvvvv wwwww xxxxx hhhhh lllll nnnnn ccccc nexxj yyyyq iiiii mmmmm qqqqq kkkkk wwwww ooooo yyyyy uuuuu kkkkk iiiih ggggg qqqqq eeeee ooooo wmuuz ooooo sasss gkffo eu...
output:
1 0 1 1 0 0 1 1 1 0 1 0 1 1 0 1 0 1 1 1 1 1 1 0 1 0 1 0 1 1 0 0 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 0 1 1 1 0 0 0 0 1 0 1 1 1 0 0 0 1 1 1 0 0 1 1 1 0 0 1 1 1 0 0 0 1 1 0 0 0 1 0 1 1 1 0 1 0 1 0 1 1 1 0 1 1 0 0 1 1 1 0 1 1 1 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 1 1 0 0 1 1 0 1 1 1 1 0 1 1 0 ...
result:
ok 500000 tokens
Test #18:
score: 0
Accepted
time: 106ms
memory: 17384kb
input:
0 50000 500000 uuuuuuueeu yyyyyyyyqq oooooooooo qqqqqqqqqq nnnnnnnnnn nnnnnnnnnn pppppppepp lldldmjmmm qqqqqqqqqq sssssssuus ppkzkrjrrr ggvgvsdsss ffffffffff mmmmmmmmmm oooooooooo aaaaaaaaaa aaaaaaaahh fffffffvff dddddddddd cccccccccc xxxxxxxexx eeeeeeesse wwwwwwwwww bbbbbbbbbb uuuuuuuuuu eeeeueeeee...
output:
0 1 0 0 0 0 1 0 0 1 1 0 0 0 1 0 0 1 1 1 1 0 0 0 1 1 0 0 1 0 0 1 0 0 1 0 1 1 1 1 0 0 1 1 1 1 0 0 1 0 0 1 0 0 0 0 0 1 0 1 1 1 1 1 0 0 1 1 0 0 0 1 1 0 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 0 0 1 1 0 0 0 0 1 0 1 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 1 1 0 0 0 1 0 1 0 0 1 0 1 0 1 0 1 1 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 1 ...
result:
ok 500000 tokens
Test #19:
score: 0
Accepted
time: 78ms
memory: 14160kb
input:
0 5000 500000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadaaaaadaaaaadaaaaaaaaaaaaaaaaaaddaaaaaaaaadaaaaaaaaaddaaddaaaaaaaaad rrwwwwwqnhnhhhuhhuppppuhuuwuuuuwuduzzuuuzzmxmtmmoaaojrneenneeeeeyqyeyvkkilhyyybzzzbiiibmbsvfvvfvlvvj uukkkkkwfcfcccgccgaaaagcggdggggdgrgmmgggmmwlwkwwgzzgtvjbbjjbbbbbtqtbtriiwyadddcooocy...
output:
1 0 0 0 1 0 1 0 0 1 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 1 1 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 1 0 0 0 1 1 1 1 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 1 ...
result:
ok 500000 tokens
Test #20:
score: 0
Accepted
time: 68ms
memory: 13496kb
input:
0 500 500000 llllllllllllllllnmnnnnmnnnnmnlllllllnnllnnbnnlllnnbbnnbnnbbnnnbbnnbnnbbbnnbbbnynbnbbnbnbbtbbtbbnbbtbbttbttbbtbbttbttbxxbtttbxkxkkxkxkkxkkxkxkxxkkxaxaaakkakkakkaakkkaakkkaaaakkkkaaaakkkaakkkakkkaakaaaaaakkakkaaakkakkaakkakkaakaakkakakakakkaakakakaiiakkkakalakakkkakalakkalaalhlallaalllaal...
output:
0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 ...
result:
ok 500000 tokens
Test #21:
score: 0
Accepted
time: 68ms
memory: 13500kb
input:
0 20 500000 hhzhhhhzhhhhxhhggpgggpgollooooomrmmrbrmjjiijjijijijijjjhhhjjhjwwjhhbbhhhhbpswswswswadadaaddlddaqqaooooarajzjzjajzjzjjzzjzjzjjjzzjaaoahfmqmihhhhimmihhiiooiihhghvhhvvevevevvkkkvvdiddpdejjggsshsbssszszszvpkykkkbbkkhvhhhvhvkkmccccccjjcjyjjyyfynyfxxfxffxffbjnnzlzznnllnlnprddlzfzlzzzzzkkkklalq...
output:
0 0 1 1 0 0 0 0 0 1 0 0 0 1 0 1 1 1 0 1 0 0 1 0 0 0 0 1 0 0 0 1 1 1 0 0 0 0 1 1 0 0 1 1 1 0 1 0 0 0 1 1 1 1 0 0 1 0 1 1 1 1 0 0 1 0 1 0 1 1 0 0 1 0 1 1 0 1 0 0 1 1 1 1 0 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 1 1 1 1 0 0 1 1 1 0 1 1 0 1 1 0 1 1 0 1 0 0 0 0 1 0 1 1 1 1 0 0 0 1 ...
result:
ok 500000 tokens
Test #22:
score: 0
Accepted
time: 64ms
memory: 13580kb
input:
0 5 500000 ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt...
output:
0 0 1 1 1 1 1 0 1 1 1 1 0 1 0 1 1 0 0 0 1 1 1 1 0 0 0 1 0 0 1 1 0 0 1 0 0 1 0 1 0 1 1 1 0 0 0 1 1 1 0 1 1 1 0 1 1 1 1 0 1 1 0 1 1 1 1 1 0 1 1 1 0 1 0 1 1 1 0 0 0 1 0 1 0 0 1 1 0 0 0 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 0 1 1 1 0 0 0 1 1 1 0 1 1 0 1 0 0 0 0 0 1 0 0 1 0 1 1 1 0 ...
result:
ok 500000 tokens
Test #23:
score: 0
Accepted
time: 57ms
memory: 13512kb
input:
0 5 500000 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzpzzzzz...
output:
0 0 1 1 1 1 1 1 1 0 1 0 1 0 1 0 0 1 1 0 1 0 0 0 0 1 1 1 0 0 1 1 0 1 1 0 1 1 1 1 1 0 0 1 0 1 1 1 1 1 0 1 1 1 1 0 1 0 1 1 0 1 1 0 1 1 1 0 0 0 1 1 0 1 0 0 1 1 1 0 1 1 1 0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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok 500000 tokens
Test #27:
score: 0
Accepted
time: 63ms
memory: 13804kb
input:
0 2 500000 sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok 500000 tokens
Test #28:
score: 0
Accepted
time: 63ms
memory: 13848kb
input:
0 2 500000 ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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uuuuuu...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok 500000 tokens
Test #31:
score: 0
Accepted
time: 52ms
memory: 14044kb
input:
0 1 500000 ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok 500000 tokens
Subtask #3:
score: 20
Accepted
Test #32:
score: 20
Accepted
time: 2ms
memory: 8308kb
input:
0 1 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
1
result:
ok "1"
Test #33:
score: 0
Accepted
time: 3ms
memory: 7924kb
input:
0 2 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
1
result:
ok "1"
Test #34:
score: 0
Accepted
time: 4ms
memory: 10264kb
input:
0 2 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
300001
result:
ok "300001"
Test #35:
score: 0
Accepted
time: 9ms
memory: 10676kb
input:
0 2 1 bccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaa...
output:
33334
result:
ok "33334"
Test #36:
score: 0
Accepted
time: 4ms
memory: 10352kb
input:
0 2 1 bccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaa...
output:
100001
result:
ok "100001"
Test #37:
score: 0
Accepted
time: 8ms
memory: 10944kb
input:
0 2 1 bcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcde...
output:
20001
result:
ok "20001"
Test #38:
score: 0
Accepted
time: 4ms
memory: 10524kb
input:
0 100 1 a j w z m h d n f c k z f c m d v o e w t r j j e l q q m y a a q g i e y p k x c q t b c r l n e t x d x w a a p g e v x o r v e n t s t x u y l x bcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaa...
output:
74976
result:
ok "74976"
Test #39:
score: 0
Accepted
time: 7ms
memory: 10152kb
input:
0 2 1 epppipfhwh wnybdiecccdcqdrdyrrrzrxizicvvvrvoxpxnpppspbnknmuuupuykckegggqgwctclhhhihvonooxxxrxwujuussswsxltlujjjpjxysyudddydrqeqozzzgznsislcccjcqlilyjgfxccctchvlvqfffhfvcpcyrrrqrstntomxvvvmvgprpawwwpwnjmjyjjjdjpbnbevvvovadmdrzzzpzothtekfffaflnwngkkkxkycncczzzgzsgvgldddjdnqmqyzzzbzwmhmmaaahawrvr...
output:
47042
result:
ok "47042"
Test #40:
score: 0
Accepted
time: 4ms
memory: 9956kb
input:
0 2 1 eoaxlzjsyyyysyyyysysyysyssysyysyssyysyyssysyssyyssysyssyysyyssyyssyysyyssyysssyyssyysyysssyysssysyysysssyyssavvhuqyhpetbpcplkobyavffffnffffnfnffnfnnfnffnfnnffnffnnfnfnnffnnfnfnnffnffnnffnnffnffnnffnnnffnnffnffnnnffnnnfnffnfnnnffnnbbbbsbbbbsbsbbsbssbsbbsbssbbsbbssbsbssbbssbsbssbbsbbssbbssbbsbbs...
output:
4748
result:
ok "4748"
Test #41:
score: 0
Accepted
time: 7ms
memory: 10108kb
input:
0 2 1 llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll...
output:
13476
result:
ok "13476"
Test #42:
score: 0
Accepted
time: 4ms
memory: 10148kb
input:
0 2 1 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...
output:
47
result:
ok "47"
Test #43:
score: 0
Accepted
time: 7ms
memory: 10344kb
input:
0 2 1 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
4
result:
ok "4"
Test #44:
score: 0
Accepted
time: 13ms
memory: 11936kb
input:
0 3 1 bbbbabaaabbaaaaabbbbabbabaabbbaaabaababbbabbaababbaaaababbaabbbaabbbababbbbbbababaaababbbbaabaabbaaaabaaabaabaabbbabaabaabbbaaaabaabbabababbaabbaaaaaababbbbabbabbaabaaabaabbbbaababbaabababbaabaaabbaabababbaabaaaababababababbaaaababbbabbababbbabaaaabababbaaabbaaabababbaaaabaaababbbaabaabbababba...
output:
0
result:
ok "0"
Subtask #4:
score: 0
Skipped
Dependency #1:
0%
Subtask #5:
score: 0
Skipped
Dependency #4:
0%