QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#705236 | #6759. 字符串 | makrav | 60 | 912ms | 30988kb | C++20 | 8.1kb | 2024-11-02 22:38:12 | 2024-11-02 22:38:15 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define pb push_back
struct polyhash {
ll n, mod;
string s;
vector<ll> h, ppow;
polyhash() = default;
polyhash(int n_, string s_, ll p, ll md) {
n = n_; s = s_;
mod = md;
h.assign(n + 1, 0);
ppow.assign(n + 1, 1);
for (int i = 1; i <= n; i++) {
ppow[i] = (ppow[i - 1] * p) % mod;
h[i] = (h[i - 1] * p + s[i - 1] - 'a' + 1) % mod;
}
}
ll diff(ll x, ll y) {
return (x - y >= 0 ? x - y : x - y + mod);
}
ll substr(int l, int r) {
return diff(h[r + 1], (h[l] * ppow[r - l + 1]) % mod);
}
};
struct sparsetable {
int n;
vector<int> vals;
vector<vector<int>> sp;
sparsetable() = default;
sparsetable(int n_, vector<int> vals_) {
n = n_;
vals = vals_;
sp.assign(18, vector<int>(n));
for (int i = 0; i < n; i++) sp[0][i] = vals[i];
for (int i = 1; i < 18; i++) {
for (int j = 0; j + (1 << i) - 1 < n; j++) sp[i][j] = min(sp[i - 1][j], sp[i - 1][j + (1 << (i - 1))]);
}
}
int get(int l, int r) {
if (l > r) swap(l, r);
int lg = 31 - __builtin_clz(r - l + 1);
return min(sp[lg][l], sp[lg][r - (1 << lg) + 1]);
}
};
struct sufarr {
int n;
string s;
vector<int> c, ord, ord2, cnt, curind, pos;
vector<pair<int, int>> lol;
vector<int> lcp;
sparsetable sp_lcp;
sufarr(int n_, string s_) {
n = n_;
s = s_;
n++;
s += '!';
c.resize(n);
ord.assign(n, 0);
ord2.assign(n, 0);
iota(all(ord2), 0);
lol.resize(n);
lcp.assign(n - 1, 0);
cnt.assign(n, 0); curind.assign(n, 0);
build();
calc_lcp();
}
void rsort() {
for (int i = 0; i < n; i++) cnt[i] = 0;
for (int i = 0; i < n; i++) cnt[lol[i].second]++;
int ci = 0;
for (int i = 0; i < n; i++) {curind[i] = ci; ci += cnt[i];}
{
for (int i = 0; i < n; i++) ord[curind[lol[i].second]++] = i;
}
{
ci = 0;
for (int i = 0; i < n; i++) {curind[i] = ci; ci += cnt[i];}
for (int i = 0; i < n; i++) ord2[curind[lol[ord[i]].first]++] = ord[i];
}
// ans in ord2
}
void build() {
vector<int> inds(n);
iota(all(inds), 0);
sort(all(inds), [&](int i, int j) {return s[i] < s[j];});
//
c[inds[0]] = 0;
int cur = 0;
for (int i = 1; i < n; i++) {
if (s[inds[i]] != s[inds[i - 1]]) cur++;
c[inds[i]] = cur;
}
for (int len = 1; len <= n; len *= 2) {
for (int i = 0; i < n; i++) {
lol[i] = {c[i], c[(i + len >= n ? i + len - n : i + len)]};
}
//sort(all(ord2), [&](int i, int j){return lol[i] < lol[j];});
rsort();
int cur = 0;
c[ord2[0]] = 0;
for (int i = 1; i < n; i++) {
if (lol[ord2[i]] != lol[ord2[i - 1]]) cur++;
c[ord2[i]] = cur;
}
}
pos.assign(n, 0);
for (int i = 0; i < sz(ord2); i++) pos[ord2[i]] = i;
}
void calc_lcp() {
polyhash pl1(n, s, 31, 1e9 + 7), pl2(n, s, 31, 998244353);
for (int i = 0; i < sz(ord2) - 1; i++) {
int L = 0, R = min(n - ord2[i], n - ord2[i + 1]) + 1;
while (R - L > 1) {
int M = (L + R) / 2;
if (pl1.substr(ord2[i], ord2[i] + M - 1) == pl1.substr(ord2[i + 1], ord2[i + 1] + M - 1) &&
pl2.substr(ord2[i], ord2[i] + M - 1) == pl2.substr(ord2[i + 1], ord2[i + 1] + M - 1)) L = M;
else R = M;
}
lcp[i] = L;
}
sp_lcp = sparsetable(sz(lcp), lcp);
// for (int el : ord2) {
// for (int j = el; j < n; j++) cout << s[j];
// cout << '\n';
// }
// for (int el : lcp) cout << el << '\n';
}
int get_lcp(int ind1, int ind2) {
return (ind1 == ind2 ? n - ord2[ind1] : sp_lcp.get(ind1, ind2 - 1));
}
int get_lcp_by_vals(int val1, int val2) {
return (val1 == val2 ? n - val1 : sp_lcp.get(min(pos[val1], pos[val2]), max(pos[val2], pos[val1]) - 1));
}
};
struct fenwick {
int n;
vector<int> t;
fenwick() = default;
fenwick(int n_) {
n = n_;
t.assign(n + 1, 0);
}
void upd(int p, int vl) {
for (; p <= n; p = (p | (p + 1))) t[p] += vl;
}
int get(int p) {
int sm = 0;
for (; p > 0; p = (p & (p + 1)) - 1) sm += t[p];
return sm;
}
};
void solve(int c) {
int n, q; cin >> n >> q;
string s; cin >> s;
string rs = s; reverse(all(rs));
sufarr sf(2 * n, s + rs);
vector<int> order_rev;
for (int el : sf.ord2) {
if (el >= n && el < 2 * n) order_rev.pb(el - n);
}
auto check = [&](int ls, int rs, int lr, int rr) {
return sf.get_lcp_by_vals(ls, n + lr) >= rs - ls + 1;
};
auto compare = [&](int is, int irs) -> bool {
int lc = sf.get_lcp_by_vals(is, irs + n);
if (lc == min(n - is, n - irs)) return (n - is == lc);
return s[is + lc] <= rs[irs + lc];
};
auto compare2 = [&](int ls, int RS, int LR, int rr) -> bool {
int lc = sf.get_lcp_by_vals(ls, n + LR);
if (lc >= RS - ls + 1) {
return 0;
}
return s[ls + lc] < rs[LR + lc];
};
if (n <= 4000 && q <= 4000) {
for (int ind = 0; ind < q; ind++) {
int i, r; cin >> i >> r;
i--;
int answ = 0;
for (int len = 1; len <= r; len++) {
answ += compare2(i, i + len - 1, n - 1 - (i + 2 * len - 1), -1);
}
cout << answ << '\n';
continue;
}
return;
}
vector<vector<array<int, 3>>> reqs(sz(order_rev) + 1);
vector<int> limitt(q);
vector<pair<int, int>> queries(q);
for (int ind = 0; ind < q; ind++) {
int i, r; cin >> i >> r;
limitt[ind] = r;
i--;
queries[ind] = {i, r};
int L = -1, R = sz(order_rev);
while (R - L > 1) {
int M = (L + R) / 2;
if (compare(i, order_rev[M])) R = M;
else L = M;
}
reqs[R].pb({i, 1 - i % 2, ind});
}
vector<int> ans(q);
fenwick fw_chet(n + 10), fw_nech(n + 10);
for (int i = n - 1; i >= 0; i--) {
int norm_ind = n - order_rev[i] - 1;
if (norm_ind % 2) fw_nech.upd(norm_ind + 1, 1);
else fw_chet.upd(norm_ind + 1, 1);
for (auto qr : reqs[i]) {
if (qr[1] == 0) {
ans[qr[2]] += fw_chet.get(2 * limitt[qr[2]] + qr[0]) - fw_chet.get(qr[0]);
} else {
ans[qr[2]] = fw_nech.get(2 * limitt[qr[2]] + qr[0]) - fw_nech.get(qr[0]);
}
}
}
if (10 <= c && c <= 14) {
vector<int> maxpal(n);
for (int i = 0; i < n; i++) {
int len = 0;
while (len <= 25 && len + 1 <= min(i + 1, n - (i + 1)) && s[i - len] == s[i + 1 + len]) len++;
maxpal[i] = len;
}
for (int i = 0; i < q; i++) {
int ind = queries[i].first;
for (int len = 1; len <= min(25, queries[i].second); len++) {
if (ind + 2 * len - 1 >= n) break;
if (compare(ind, n - (ind + 2 * len - 1) - 1) && maxpal[ind + len - 1] >= len) {
ans[i]--;
}
}
}
}
for (int el : ans) cout << el << '\n';
}
signed main() {
#ifdef LOCAL
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
cin.tie(0)->sync_with_stdio(false);
int c, t; cin >> c >> t;
while (t--) {
solve(c);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Final Tests
Test #1:
score: 4
Accepted
time: 1ms
memory: 3560kb
input:
1 5 5 5 aaaaa 4 1 2 1 2 2 2 2 4 1 5 5 abaab 1 1 1 2 2 1 3 1 1 1 5 5 baaaa 1 2 2 2 2 2 2 1 2 2 5 5 babab 1 2 2 2 4 1 2 2 2 2 5 5 baaab 2 2 2 1 1 1 1 2 2 2
output:
0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 2 1 2 2 1 0 0 0 1
result:
ok 25 numbers
Test #2:
score: 4
Accepted
time: 0ms
memory: 3568kb
input:
2 5 10 10 babbbbbaaa 1 4 9 1 6 2 2 3 2 1 1 5 1 5 4 2 1 2 2 4 10 10 baabbaabab 1 5 2 4 2 4 2 3 3 4 5 3 2 3 1 5 3 1 4 1 10 10 aaaaabaabb 1 5 6 2 3 2 2 2 1 1 5 1 1 5 1 5 1 4 3 3 10 10 babbaababb 5 3 7 1 7 2 1 4 6 1 4 2 2 4 2 4 4 1 1 5 10 10 babbbaabba 2 3 1 5 6 2 2 4 1 5 4 1 2 3 5 2 2 3 1 5
output:
2 0 0 3 1 2 2 0 1 3 1 2 2 1 3 1 1 1 1 0 3 0 1 0 0 1 3 3 2 2 2 0 1 1 1 0 3 3 0 2 2 1 1 3 1 0 2 0 2 1
result:
ok 50 numbers
Test #3:
score: 4
Accepted
time: 0ms
memory: 3572kb
input:
3 5 19 19 baaababbbbbaaabbbaa 13 1 1 7 7 6 10 2 4 5 18 1 16 1 7 6 6 5 6 5 3 8 4 7 6 3 2 8 14 3 11 4 11 3 1 4 1 9 19 19 bbaababbaaaaababbba 9 1 10 4 16 1 1 9 4 6 5 4 15 1 1 7 2 6 5 7 14 3 1 9 11 3 1 7 8 6 2 8 10 1 2 8 8 2 20 19 baabaaabaabaaaababba 3 7 1 8 4 5 14 2 7 7 1 5 1 8 15 2 2 8 2 6 3 5 2 4 6 ...
output:
0 2 0 0 4 0 0 0 4 4 6 6 3 7 2 1 1 1 3 0 2 0 2 3 1 1 1 1 2 1 2 2 1 1 2 0 2 0 4 0 1 1 4 0 0 2 5 4 3 2 2 2 6 0 5 5 2 6 1 7 2 2 1 2 0 0 2 4 5 1 5 2 4 3 1 0 6 1 0 4 7 0 0 0 4 0 4 1 1 7 1 7 4 0 0 2
result:
ok 96 numbers
Test #4:
score: 4
Accepted
time: 1ms
memory: 3568kb
input:
4 5 46 50 abababbbbbbbbbabaabaaababbaaaaabababbababaaaaa 1 13 19 1 7 19 22 7 3 21 3 17 3 21 31 6 1 23 11 4 19 11 4 17 2 21 7 20 10 8 25 9 9 19 6 4 7 18 5 4 2 1 12 9 6 20 17 13 7 1 9 17 1 21 12 6 11 11 1 23 5 16 28 6 4 17 10 2 3 19 34 5 21 13 1 23 13 6 31 5 6 20 4 20 3 21 16 1 1 21 17 2 2 19 23 4 1 7...
output:
9 0 0 3 12 11 12 5 14 0 3 5 6 0 0 0 0 0 0 4 0 0 0 10 0 0 14 0 0 14 10 4 5 0 12 1 9 14 0 5 0 5 12 0 14 1 6 1 7 8 8 7 5 15 5 0 16 0 0 13 0 5 14 9 1 14 6 0 5 15 13 9 7 1 0 3 15 4 5 5 3 1 6 1 12 3 0 16 1 7 8 3 13 0 2 0 14 0 3 1 4 0 8 7 3 8 8 13 7 1 13 13 15 3 9 3 9 10 1 10 1 0 10 15 5 0 5 6 2 9 0 12 5 4...
result:
ok 246 numbers
Test #5:
score: 4
Accepted
time: 1ms
memory: 3828kb
input:
5 5 97 98 bbaabaabbababaaaababaabababaabaababbbbbbaababaabaaabbaabbabaabbaababbabbbbbaababbbbabbbbbbbaaaaab 71 13 77 7 13 3 14 40 18 21 13 38 20 18 2 48 30 27 84 4 3 34 4 15 18 36 55 20 3 44 9 36 10 24 15 8 55 15 48 6 38 18 30 16 19 7 4 47 76 4 36 28 3 38 7 43 13 3 7 22 55 12 9 22 26 17 30 23 24 31 ...
output:
1 7 0 38 7 18 8 25 15 4 30 9 17 15 40 5 14 7 11 3 1 8 4 31 3 3 34 24 0 8 8 3 12 13 20 8 0 0 6 5 9 10 16 21 2 16 1 24 2 9 6 9 31 15 26 7 9 12 25 0 18 0 19 24 31 18 41 3 9 13 11 19 0 1 25 1 0 22 27 17 35 0 7 10 3 9 21 5 15 0 33 2 5 5 18 24 9 20 5 14 1 12 4 15 0 10 9 4 6 18 2 10 3 31 14 26 13 1 13 6 4 ...
result:
ok 482 numbers
Test #6:
score: 4
Accepted
time: 10ms
memory: 3712kb
input:
6 5 998 992 bibbaabpaapbaabbibbbbabbaabbaafbaabbaabbaabbaabfaabbaabbabbbabbbaabpaapbaabbbabobabbaabbaafbaabbaabbaabbaabfaabbaabbabbbbbbbaabpaapbaabbbbbbbabbaabbaafbaabbaabbaabbaabfaabbaabbabobabbbaabpaapbaabbbabbbabbaabbaafbaabbaabbaabbaabfaabbaabbabbbbibbaabpaapbaabbibbbbabbaabbaafbaabbaabbaabbaabf...
output:
32 48 41 62 267 134 145 111 337 312 88 335 139 173 174 97 77 19 155 291 125 23 110 17 13 167 61 126 6 74 214 59 0 200 42 47 125 9 3 119 132 216 0 31 105 61 4 355 141 39 53 60 89 39 52 208 259 17 12 194 355 77 65 53 298 60 138 308 198 120 118 114 207 8 9 68 264 307 366 2 356 6 15 32 120 56 6 93 67 36...
result:
ok 4970 numbers
Test #7:
score: 4
Accepted
time: 26ms
memory: 3980kb
input:
7 5 1988 1997 bvappavbbaabavavpavbbaabbvappavbbaabbvappavbbaabbvappavbbaaqbvappavbbaabbvappavbqaabbvappavbbaabbvappavbbaabbvappavbbaabbvappavabaabbvappavbbaaqbvappavbbaabbpappavbqaabbvappavbbaabavappavbbaabbvappavbbapbbvappavbbaabbvappavbbaaqbvappavbbaabbvappavbqaabbvappavbbaabbvappavbbpabbvappavbba...
output:
20 302 418 404 6 12 674 787 520 153 145 127 633 4 157 792 146 103 326 395 41 38 130 151 222 2 8 301 48 314 90 194 37 53 6 124 558 828 512 89 13 140 221 47 492 94 123 111 63 12 436 34 1 169 681 135 205 303 114 453 96 227 420 112 663 85 43 104 713 28 42 8 17 180 613 81 19 713 89 446 260 171 14 501 58 ...
result:
ok 9977 numbers
Test #8:
score: 4
Accepted
time: 61ms
memory: 4248kb
input:
8 5 2977 2978 aabaaaabaabaaaabaabaaaabaabnaaabaabaaaabaabaaaabaabaaaabaabaaaabaabaaaabaabaaanbaabaaaabaabaaaabaabaaaabaabaaaabaabaaaabaabaaaabaabaaaabaabaaaabaabaaaabaabaaaabaabaaaabaabaaaabaabaaaabaabaaaabaabaaaabaabaaaabaabaaaabaabaaaabaabaaaabaabaaaabaabaaaabaabaaaabaabaaaabaabaaaabaabaaaabaabaaa...
output:
465 335 734 0 461 942 8 412 161 207 532 754 409 375 164 1044 567 1109 1112 1041 96 400 888 1263 30 1029 887 56 614 1099 98 765 128 841 54 372 16 9 935 124 1072 706 232 790 558 16 371 264 52 1255 661 391 0 358 492 696 1197 441 183 129 493 740 256 128 584 53 1185 239 1214 891 844 151 401 243 395 1134 ...
result:
ok 14916 numbers
Test #9:
score: 4
Accepted
time: 104ms
memory: 4544kb
input:
9 5 3992 3963 baaamarbaaaabramaaabbaabmarbaaaabrambaabbaabmarbaaaabrambaabbaabmarbaaaabrambbabbaabmarbaaaabrambaabbaabmarbaaaabrambaabbaaamarbaaaabramaaabbaabmarbaaaabrambaabbaabmarbaaaabrambaabbabbmarbaaaabrambaabbaabmarbaaaabrambaabbaabmarbaaaabrambaabbaaamarbaaaabramaaabbaabmarbaaaabrambaabbaabma...
output:
336 177 335 701 21 1027 512 925 1488 1776 101 446 1240 1607 541 20 314 269 324 474 86 1128 18 372 311 1047 462 80 1177 972 201 5 626 845 652 719 476 86 361 699 827 499 1740 121 325 435 40 891 201 204 62 132 1255 52 813 492 867 845 793 61 1432 1544 5 27 51 19 428 842 1242 752 1302 225 176 108 1154 31...
result:
ok 19867 numbers
Test #10:
score: 4
Accepted
time: 200ms
memory: 11120kb
input:
10 5 21773 22026 babaaababbabbbbbaababbababaabbababbabbbbabaaaaabaabbabbbbbbaaaabaababbbabbbbbabaababbaababbbbaaabaabbaaaabbbbaaaabbbbbabaaaaaaaabbabbabbaabbbbabbbaaabbabbabababbaabaabbaabbaaaaabaabaababaabbaaaaaabababbaabbababaabbabbaaaaaaaaabbaabbbaabbababbbbbaaaaaabaaabbbaabaaabbabbabaabbbbabbabb...
output:
605 606 870 1877 2959 7799 3875 2952 39 6360 3249 67 2082 6986 393 190 1152 892 2734 2346 25 1130 3784 44 2336 1221 547 1244 169 4481 7213 4746 125 1065 6830 1658 2057 3586 1335 1398 1853 1172 6995 37 5093 2550 3490 3992 161 604 45 935 1271 334 250 1312 7945 6837 0 3573 332 1692 6539 5739 1893 8430 ...
result:
ok 109320 numbers
Test #11:
score: 4
Accepted
time: 534ms
memory: 20168kb
input:
11 5 47391 45803 aababababbbbbbbbbbbaabaabababaababbbbabbabbabaabbbbabbbbaaaababbabababbabbabbaabbbaaabaaaabbbabababbaababbbabbabbabbbabaabbabaabaaaabbbbbbbbabbbbbababbaaababbbababbabaababbaaaaaaaaabaababaababbaaaabbbbaaababbaabaaabbabaaaaaabbababababbababaaaabbbaaaaaaaaaaabbbbbbbabbbaaabababaaababa...
output:
4187 3688 103 3723 2769 13827 13979 644 1458 10311 4489 1555 3876 1467 347 635 253 31 13744 3311 4567 8057 8348 1535 688 13113 483 8597 8775 4255 9923 3224 1010 79 8866 3892 7422 1582 7336 3033 10456 7159 3243 16103 3328 8457 364 1124 2163 1566 7741 4080 2561 18853 1239 10074 1016 2604 1382 4437 663...
result:
ok 236962 numbers
Test #12:
score: 4
Accepted
time: 912ms
memory: 27996kb
input:
12 5 69918 68763 bbabbbabbbaaabaabbbbbbbbbabbbbbbbbaaabaabaabbbaabaaaabbabbabbbbbabbbbaabaaaabaabbababbbbbaaababbabbbbaabbbaaabaaaaababaaabbbbababababbababbbaaabbbbaabbabbbbbbbbabbabbbbaaabbbbaaababbbaaabaaabbabaaabbaabbbaaabbbbbbaabaabbbaabaaabbbabbbbbaabaabbabbbabbababbaaaabbbbbbbaabaaaabbabaaaaab...
output:
614 22361 3580 4071 4361 2218 17420 6215 4184 8818 7589 19792 8267 1773 46 1287 3821 25097 6602 10307 7693 26755 13718 3090 148 340 23284 4036 10048 3451 2001 686 4222 3169 17770 13155 8108 10690 4354 3601 9031 8539 3752 15172 18009 2243 1614 220 6139 22729 21068 1844 14873 1759 5013 2672 4514 13169...
result:
ok 346956 numbers
Test #13:
score: 0
Time Limit Exceeded
input:
13 5 86855 85346 bbaaababbbbbaaaabbbaabbabbabbaabbbabbbbbbbaabaabbaabbaaaabbabaaaabbaaaabababbbbbbbbaabbabababaabaababaaabbabaabaaabaabaabbbabbabbbaabaaaabbbbabbbaabbabaabbabbbaabbbbbaaaaabbbbaaaababbbabaaabaababaababaaabbbaaaababbabaababaabababaababbabbbabaabaaabbabababbbbbbaaaababababbabaabaaaaabb...
output:
23397 497 37521 13084 16190 5014 39195 2818 7676 13149 29388 16788 9755 6909 28102 17426 12692 25728 7138 20352 5086 8739 2657 496 34203 3815 7691 18151 208 26131 7994 21088 3198 3550 17965 13389 12003 1097 4936 2049 9546 460 8972 3717 24214 1105 1632 6965 22150 16897 21692 16810 2538 32408 12849 11...
result:
Test #14:
score: 0
Time Limit Exceeded
input:
14 5 95651 97657 babbbababaaaabaaaaaaaabbaaabaababbaabbaabbabbaaabababaabaaaabaaaabbbabbabbaaaabbaabbbbbbbbaabbaabbbaaabaaabababbabababbabbbababaabaababbaabbababbbabbbbabbbbabbaaaaabaaaabbabbbabbbabbaababbbabbaaabaabbbbbbbabbabbbabaaaabaaaaaaaababaababbabaaaabaababaababbaaaaababaaabbbbabababbbabaabb...
output:
16666 26260 7301 9219 17848 7041 13588 538 10511 5249 30399 9348 28342 3847 7512 9692 41788 18592 13194 7424 18368 4493 734 9223 199 13124 6893 31855 5054 34072 32148 1798 17634 3488 15848 8095 2947 5926 5118 5355 12682 10064 37287 36556 10884 2817 19446 15735 2004 27803 26891 12199 14432 36470 9212...
result:
Test #15:
score: 4
Accepted
time: 162ms
memory: 11064kb
input:
15 5 21209 21227 babababakakababfbrbabababauabababfbababababakabababfbababababakabababfbababababakabababfbababababakabababfbababababakabababfbalabababakabababfbababababakabababfbrbabababauabababfbababababakabababfbababababakabababfbababababakabababfbababababakabababfbababababakabababfbababababakabab...
output:
875 8428 694 990 9417 1004 607 3128 8428 528 10263 451 1510 1 8757 272 5285 2056 178 54 3412 1160 491 6677 6540 7486 707 409 919 377 3178 339 3932 28 338 421 39 992 1206 2689 712 20 437 5233 6165 9492 49 1315 3028 778 981 4525 4967 10255 1306 1015 1095 2415 1040 933 3517 1255 1117 8592 55 124 780 52...
result:
ok 110426 numbers
Test #16:
score: 4
Accepted
time: 755ms
memory: 27292kb
input:
16 5 73529 68306 babsbababwbsbabsbabababsbabsbababwbsbadsbababwbsbabsbabsbwbsbabsbababwbsbabsbababwbsbabsbababwbsbabsbabababsbabsbababwbsbadsbababwbsbabsbabsbwbsbabsbababwbsbabsbababwbsbrbsbababwbsbabsbabababsbabsbababwbsbadsbababwbsbabsbabsbwbsbabsbababwbsbabsbababwbsbabsbababwbsbabsbabababsbabsbab...
output:
1 1262 2399 1 0 1 10730 1 0 1 30489 3312 4248 935 8645 14603 10699 0 0 13368 35363 10221 11654 32384 7456 15281 0 1 3274 17255 1 14138 8866 11994 34570 1 15001 8483 10232 4695 1473 635 16542 0 16332 4700 9621 2069 11473 0 3673 23257 4871 1 5197 13419 7209 1 14946 1 1 2201 9540 455 12114 15470 1 0 17...
result:
ok 359447 numbers
Test #17:
score: 4
Accepted
time: 911ms
memory: 30988kb
input:
17 5 87085 88577 ababababababvbabababababababababababvbabababababababababababvbabababatabababababababvbabababababababababababvbabababababababababababvbabababababababababababvbabababababababababababvbabababababababababababvbabababababababababababvbabababababababababababvbabababatabababababababvbababa...
output:
11254 27 760 3385 0 4335 871 683 513 2774 1250 1998 2174 2463 974 6871 13078 2817 2453 1096 3372 2677 0 513 36833 1611 6019 1681 43004 1353 12306 18622 39485 2589 37733 9624 589 1277 3638 526 1272 0 14907 40922 484 536 1394 35414 3661 37 0 1118 40967 2330 2103 1458 2071 3250 982 1862 190 1907 0 0 0 ...
result:
ok 436679 numbers
Test #18:
score: 0
Time Limit Exceeded
input:
18 5 99489 97628 abababacababababacababababacababababacababababacababababacababababacababababacababababacababayabacababababacabababxbacababababacababababacababababacababababacababababacababababacababababacababababacababababacababayabacababababacababababacababababacababababacababababacababababacababa...
output:
445 707 42132 580 26762 655 39 497 44253 161 2051 39980 19110 40444 266 38617 11389 4931 29403 376 333 626 12248 653 10 648 686 24032 665 291 252 24777 44211 463 313 566 178 49505 25926 647 36 407 625 44175 46231 461 30278 25555 46539 15563 365 46328 554 624 524 27228 32996 577 33323 11690 459 36932...
result:
Test #19:
score: 0
Wrong Answer
time: 209ms
memory: 11048kb
input:
19 5 23197 23286 abbbaabaaabbaabbaaabaabbbabbabbhaabaaabbaabbaaabaabbbabbambbaabaaabbaabbaaabaabbmabbabbbaabaaabbaabbaaabaabbbabbabbbaabaaabbaabbaaabaabbbabbabbbaabaaabbaabbaaabaabbaabbambbaabaaabbaabbaaabaabbmabbabbbaabaaabbaabbaaabaahbbabbabbbaabaaabbaabbbaabaabbbabbabbbaabaaabbaabbaaabaabbbabbamb...
output:
1911 2683 1806 4506 5628 1092 2564 4921 2075 2060 438 2770 12 3751 3033 1103 8738 7616 2669 794 3839 5641 3110 4980 97 883 4765 43 673 7203 4568 2555 134 824 165 430 5247 6151 3669 4358 279 5175 2960 5079 5646 373 3912 6780 1678 2852 2624 1167 270 4198 2353 2213 1827 484 8848 2892 4029 10344 6669 18...
result:
wrong answer 1st numbers differ - expected: '1910', found: '1911'
Test #20:
score: 0
Wrong Answer
time: 563ms
memory: 20412kb
input:
20 5 49694 49669 bbabbbbbbabbbbbbbaabbbbbbaabbbbbbasbbbbbbaabbbbbbaabbbbbbaabbbbbbaabbbbbbaabbbbbbaabbbbbbsabbbbbbaabbbbbbaabbbbbbbabbbbbbabbbbbbbaabbbbbbaabbbbbbasbbbbbbaabbbbbbaabbbbbbaabbbbbbaabbbbbbaabbbbbbaabbbbbbsabbbbbbaabbbbbbaabbbbbbbabbbbbbabbbbbbbaabbbbbbaabbbbbbasbbbbbbaabbbbbbaabbbbbbaa...
output:
13572 1022 5377 9536 1706 1799 33 1979 2449 2437 20681 5766 7266 1053 11907 19152 10709 2559 2229 1561 635 5204 22617 9942 5392 16733 4149 14323 448 1313 20353 5064 6234 221 8660 3364 4789 4216 2203 4613 15393 5473 4259 21903 10086 6415 297 2160 2480 38 769 6944 3403 375 11748 6217 142 1036 2385 27 ...
result:
wrong answer 1st numbers differ - expected: '13569', found: '13572'
Test #21:
score: 0
Time Limit Exceeded
input:
21 5 74422 74421 baabbllbbaabblabbaabbllbbaabbllbblabbllbbaabbllbbaabbllbbaabbllbbaabbllbbaabbllbbaabbllbbaabbllbbaabbllbbaabbllbbaabbllbbaabbllbbaabbllbbaabbblbbaabbllbbaabbllbbaabbllbbaabbllbbaabbllbbaabbllbbaabbllbbaabbllbbaabbllbbaabbllbbaabbllbbaabbllbbaabbllbbaabbllpbaabbllbbaabbllbbaabpllbbaa...
output:
8470 12814 14893 15418 2088 15622 4856 25185 3568 9950 10867 456 8992 3500 13294 6664 9956 1393 10607 9952 20962 10725 285 345 684 19342 23365 3211 6245 30 23136 3419 17635 4457 5783 15887 25370 32447 23801 8016 17241 10472 24074 1552 17226 20157 954 15969 325 4415 7360 29545 13604 3148 19995 4775 9...
result:
Test #22:
score: 0
Time Limit Exceeded
input:
22 5 89983 89431 bajbbbzbbaabbzabbjabbaabbajbbazbbaabbzbbbjabbaabbajbbazbbaabbzabbjabbaabbajbbazbbaabbzabbjabbaabbajbbazbbaabbzabbjabbaabbajbbazbbaabbzabbjabbaabbajbbazbbaabbzabbjabbaabbajbbbzbbaabbzabbjabbaabbajbbazbbaabbzbbbjabbaabbajbbazbbaabbzabbjabbaabbajbbazbbaabbzabbjabbaabbajbbazbbaabbzabbja...
output:
11851 4470 9680 10841 25353 5873 5146 8020 8837 7876 14485 396 6546 4576 23187 18650 2244 20336 736 1465 520 21158 32926 12087 10330 27915 26183 7147 2530 34776 4770 9998 1168 17022 5020 248 574 19548 26220 15096 445 109 12051 15361 8026 285 19816 25567 31750 8006 11751 12204 183 9930 19054 14278 30...
result:
Test #23:
score: 0
Time Limit Exceeded
input:
23 5 94783 94700 baabaaaabaabbaabbaabaaaabaabbaabbaabaaaabaabbaaabaabavaabaabaaabbaabaaaabaabbaabbaapaaaabaabbaabbaabaaaabaabbaaabaabaaaabaabaaabbaabaaaabaabbaaabaabaaaabaabbaabbaabaaaabaabbaaabaabaaaabaabaaabbaabaaaabaabbaabbaabaaaabaabbaabbaabaaaabaabbaaabaabaaaabaabaaabbaabaaaabaabbaabbaabaaaabaa...
output:
8045 2026 11771 26959 10327 14092 36040 9210 29683 9971 26258 3343 1339 4312 3852 1007 29532 20421 13041 2528 14574 8892 15588 221 807 8789 3064 10329 15478 1174 7873 9745 11345 13 1845 8621 290 3119 14916 2032 8297 1551 6960 544 2856 16593 2052 26688 37561 3144 31237 5568 3355 2933 1760 7871 5871 2...
result:
Test #24:
score: 0
Time Limit Exceeded
input:
24 5 99576 99977 babbbaabbaabbbabbaabbadbbaabbaabbdabbaabbadbbaabbaabbdabbaabbabbbaabbaabbbabbaabbadbbaabbaabbdabbaabbadbbaabbaabbdabbaabbabbbaabbaabbbabbaabbadbbaabbaabbdabbaabbadbbaabbaabbdabbaabbabbbbabbaabbbabbaabbadbbaabbaabbdabbaabbadbbaabbaabbdabbaabbabbbaabbaabbbabbaabbadbbaabbaabbdabbaabbad...
output:
25234 22884 4206 25969 30497 8687 15592 4265 24 3 680 3537 18273 725 29249 5674 2310 34071 1099 2151 1226 17815 26165 311 13480 7902 951 13546 7389 17395 16710 13917 4721 35023 5767 16849 1661 3850 5424 13560 7245 925 39107 2838 1106 13497 20013 19227 16488 4070 1265 16437 553 13228 11879 16012 1914...
result:
Test #25:
score: 0
Time Limit Exceeded
input:
25 5 99821 99309 aabbaabbaxbbaabbaabbaabbxabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbabbbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbbabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaxbbaabbaabbaabbxabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbabbbaabeaabbaab...
output:
9305 10238 15505 4886 29725 9466 6165 10277 13792 30290 4377 12591 23525 10311 1238 14624 18818 3750 8903 7662 2500 27158 3517 12933 14135 24136 21 969 4128 15324 1065 3218 5259 322 32594 190 5354 15125 7340 5503 20828 1606 7651 17296 9822 9704 265 2996 503 33951 5003 2405 13469 1898 815 7458 27100 ...