QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#210158 | #5037. 回文 | hos_lyric# | 30 | 2664ms | 78968kb | C++14 | 7.1kb | 2023-10-11 03:54:01 | 2024-07-04 02:18:33 |
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;
}
// point add, rectangle sum
constexpr int INF = 1001001001;
template <class X, class Y, class T> struct Bit2d {
vector<X> xs;
vector<pair<Y, X>> yxs;
vector<vector<Y>> yss;
int m;
vector<int> ns;
vector<vector<T>> bit;
Bit2d() {}
void book(X x, Y y) {
xs.push_back(x);
yxs.emplace_back(y, x);
}
void build() {
sort(xs.begin(), xs.end());
xs.erase(unique(xs.begin(), xs.end()), xs.end());
m = xs.size();
yss.assign(m, {});
sort(yxs.begin(), yxs.end());
for (const auto &yx : yxs) {
const int x = yx.second, y = yx.first;
const int a = lower_bound(xs.begin(), xs.end(), x) - xs.begin();
assert(a < m); assert(xs[a] == x);
for (int u = a; u < m; u |= u + 1) yss[u].push_back(y);
}
ns.assign(m, 0);
bit.assign(m, {});
for (int u = 0; u < m; ++u) {
yss[u].erase(unique(yss[u].begin(), yss[u].end()), yss[u].end());
ns[u] = yss[u].size();
bit[u].assign(ns[u], 0);
}
}
void add(int x, int y, T val) {
const int a = lower_bound(xs.begin(), xs.end(), x) - xs.begin();
assert(a < m); assert(xs[a] == x);
for (int u = a; u < m; u |= u + 1) {
const int b = lower_bound(yss[u].begin(), yss[u].end(), y) - yss[u].begin();
assert(b < ns[u]); assert(yss[u][b] == y);
for (int v = b; v < ns[u]; v |= v + 1) bit[u][v] += val;
}
}
T get(int x0, int x1, int y0, int y1) const {
const int a0 = lower_bound(xs.begin(), xs.end(), x0) - xs.begin();
const int a1 = lower_bound(xs.begin(), xs.end(), x1) - xs.begin();
T ret = 0;
for (int u = a0; u; u &= u - 1) ret -= get(u - 1, y0, y1);
for (int u = a1; u; u &= u - 1) ret += get(u - 1, y0, y1);
return ret;
}
private:
T get(int u, int y0, int y1) const {
T ret = 0;
const int b0 = lower_bound(yss[u].begin(), yss[u].end(), y0) - yss[u].begin();
const int b1 = lower_bound(yss[u].begin(), yss[u].end(), y1) - yss[u].begin();
for (int v = b0; v; v &= v - 1) ret -= bit[u][v - 1];
for (int v = b1; v; v &= v - 1) ret += bit[u][v - 1];
return ret;
}
};
char S[200'010];
int N, Q;
vector<int> O, I, L, R;
vector<char> C;
namespace brute {
vector<int> run() {
cerr<<"[brute::run]"<<endl;
string s = S;
vector<int> anss;
int lastans = 0;
for (int q = 0; q < Q; ++q) {
if (O[q] == 1) {
const int i = (I[q] ^ lastans) - 1;
s[i] = C[q];
} else {
const int l = (L[q] ^ lastans) - 1;
const int r = (R[q] ^ lastans);
const auto rs = manacher(s);
int ans = 0;
for (int i = l; i < r; ++i) if (rs[i + r] >= r - i) {
++ans;
}
anss.push_back(ans);
lastans = ans;
}
}
return anss;
}
} // brute
namespace sub2 {
vector<int> run() {
cerr<<"[sub2::run]"<<endl;
const auto rs = manacher(string(S));
Bit2d<int, int, int> bit;
for (int i = 0; i <= 2 * N; ++i) bit.book(i, rs[i] + i);
bit.build();
for (int i = 0; i <= 2 * N; ++i) bit.add(i, rs[i] + i, 1);
vector<int> anss;
int lastans = 0;
for (int q = 0; q < Q; ++q) {
const int l = (L[q] ^ lastans) - 1;
const int r = (R[q] ^ lastans);
/*
l <= i < r && rs[i + r] >= r - i
l + r <= j < 2 r && rs[j] + j >= 2 r
*/
const int ans = bit.get(l + r, 2 * r, 2 * r, 3 * N);
anss.push_back(ans);
lastans = ans;
}
return anss;
}
} // sub2
namespace sub3 {
constexpr int K = 60;
string s;
bool isPalin(int l, int r) {
for (; l < --r; ++l) if (s[l] != s[r]) return false;
return true;
}
vector<int> run() {
cerr<<"[sub3::run]"<<endl;
s = S;
vector<Int> fs(N + 1, 0);
for (int r = 0; r <= N; ++r) {
for (int k = 1; k <= K && r - k >= 0; ++k) {
if (isPalin(r - k, r)) {
fs[r] |= 1LL << k;
}
}
}
vector<int> anss;
int lastans = 0;
for (int q = 0; q < Q; ++q) {
if (O[q] == 1) {
const int i = (I[q] ^ lastans) - 1;
s[i] = C[q];
// cerr<<COLOR("33")<<s<<" "<<1<<" "<<i<<" "<<C[q]<<COLOR()<<endl;
for (int r = i + 1; r <= i + K && r <= N; ++r) {
for (int k = r - i; k <= K && r - k >= 0; ++k) {
fs[r] &= ~(1LL << k);
if (isPalin(r - k, r)) {
fs[r] |= 1LL << k;
}
}
}
} else {
const int l = (L[q] ^ lastans) - 1;
const int r = (R[q] ^ lastans);
// cerr<<COLOR("33")<<s<<" "<<2<<" "<<l<<" "<<r<<COLOR()<<endl;
const int ans = __builtin_popcountll(fs[r] & ((1LL << (min(r - l, K) + 1)) - 1));
anss.push_back(ans);
lastans = ans;
}
}
return anss;
}
} // sub3
int main() {
for (; ~scanf("%s", S); ) {
N = strlen(S);
scanf("%d", &Q);
O.resize(Q, -1);
I.resize(Q, -1);
C.resize(Q, '?');
L.resize(Q, -1);
R.resize(Q, -1);
for (int q = 0; q < Q; ++q) {
scanf("%d", &O[q]);
if (O[q] == 1) {
scanf("%d %c", &I[q], &C[q]);
} else {
scanf("%d%d", &L[q], &R[q]);
}
}
vector<int> anss;
if (O == vector<int>(Q, 2)) {
anss = sub2::run();
} else if (N <= 5000 && Q <= 5000) {
anss = brute::run();
} else {
anss = sub3::run();
}
for (const int ans : anss) {
printf("%d\n", ans);
}
}
return 0;
}
詳細信息
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 101ms
memory: 3924kb
input:
aabbbabbbaaaaaaabbabbbaaaabaaaabbaabbaabbaaababbbabbbbabbbbaaaabbbabbbbbaaabbbabbaaaaabbbbbaaababbabbaaaaabaabbbbaaababaaabbaabbabbbabbbbaaaaabbbbbbbabbbaabbbabbabbbababbabbbbaaaaabbaababbbbaabbaaaaaabaaabbbaaababbbbaabaaaaababababbbbbbaaaabbbbaaababaaabbaabbbbbaaaabbaaaabaaaaaababbababaaaabaaababaa...
output:
2 3 5 3 3 3 2 3 4 2 4 2 4 2 3 3 3 2 2 2 2 2 2 3 4 2 2 3 2 2 4 3 3 2 3 3 4 3 3 4 4 2 3 4 2 2 4 2 4 3 2 2 2 3 3 3 4 4 3 3 2 3 3 2 3 3 4 2 2 4 2 3 2 3 3 2 3 2 2 3 2 2 3 6 2 2 3 7 4 3 2 2 2 2 3 4 4 4 4 2 2 3 2 4 2 2 2 3 3 2 2 2 2 3 3 4 3 2 3 3 2 2 4 5 4 2 2 5 3 3 3 3 2 4 2 3 2 3 3 3 2 4 4 5 2 2 3 5 3 3 ...
result:
ok 2509 tokens
Test #2:
score: 0
Accepted
time: 63ms
memory: 3932kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
188 1078 673 914 360 4255 2205 3628 77 3608 230 494 128 848 801 1335 4079 3059 636 2882 3524 45 1174 506 3570 4172 1289 595 3829 1532 179 1274 2574 1098 2817 226 2580 887 989 1829 3656 181 2056 3315 786 117 2519 2742 3787 1080 3138 686 1605 239 1533 2658 2096 753 3400 219 1815 117 1645 52 1671 121 2...
result:
ok 2519 tokens
Test #3:
score: 0
Accepted
time: 6ms
memory: 5008kb
input:
bbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbbbbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbbbbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbbbbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbba...
output:
12 8 12 24 30 18 11 8 32 18 10 32 26 11 11 15 18 6 18 19 13 21 10 13 20 16 10 10 10 9 16 11 32 14 24 20 29 15 10 17 10 8 8 22 31 9 9 18 25 10 14 16 22 24 15 15 11 13 33 7 13 21 7 19 12 12 17 7 23 15 2 10 16 15 9 14 6 18 10 8 18 20 21 5 11 18 3 17 13 17 8 11 17 7 6 7 11 10 9 20 9 28 19 10 14 11 24 8 ...
result:
ok 5000 tokens
Test #4:
score: 0
Accepted
time: 4ms
memory: 5040kb
input:
mkmamkmlmkmamkmnmkmamkmlmkmamkmamkmamkmlmkmamkmnmkmamkmlmkmamkmumkmamkmlmkmamkmnmkmamkmlmkmamkmamkmamkmlmkmamkmnmkmamkmlmkmamkmkmkmamkmlmkmamkmnmkmamkmlmkmamkmamkmamkmlmkmamkmnmkmamkmlmkmamkmumkmamkmlmkmamkmnmkmamkmlmkmamkmamkmamkmlmkmamkmnmkmamkmlmkmamkmpmkmamkmlmkmamkmnmkmamkmlmkmamkmamkmamkmlmkma...
output:
5 8 5 6 5 6 7 7 5 8 5 5 6 5 9 6 5 6 7 8 5 5 8 6 4 5 8 5 8 4 6 4 5 6 5 1 5 7 4 5 7 3 5 8 9 6 4 5 5 4 7 7 5 7 8 7 6 5 7 1 5 5 6 6 6 6 7 6 6 4 5 5 6 3 8 7 5 6 6 7 4 4 7 7 6 6 7 8 6 7 7 4 7 6 8 3 5 7 3 6 7 6 4 7 6 4 5 6 6 4 6 7 4 5 5 5 4 4 5 6 3 4 4 5 4 7 5 4 9 6 5 5 3 4 5 8 4 5 5 6 4 6 6 6 4 9 7 4 6 6 ...
result:
ok 5000 tokens
Test #5:
score: 0
Accepted
time: 59ms
memory: 3964kb
input:
babababababababababababababababababababababababababababababababbbabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababbbabababababababababababababababababababababababababababababababbbabababababababababababababababababababababa...
output:
58 13 6 23 52 35 39 46 17 43 37 33 31 8 51 12 9 52 57 14 28 17 31 21 59 50 55 50 18 10 54 7 44 11 10 3 12 19 9 8 5 7 22 4 38 15 10 14 26 11 21 18 33 12 3 8 23 34 41 18 7 18 26 7 12 29 34 6 4 15 16 20 15 8 50 23 7 51 18 4 11 7 20 14 33 19 12 9 10 6 8 21 28 22 21 18 12 18 4 15 17 13 8 16 7 14 10 4 5 3...
result:
ok 2443 tokens
Test #6:
score: 0
Accepted
time: 82ms
memory: 3932kb
input:
aaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaa...
output:
43 25 18 13 12 27 16 18 22 24 13 20 34 18 5 27 26 27 8 10 6 9 9 14 22 15 34 25 19 24 19 18 13 7 21 14 2 33 7 46 16 18 19 12 25 8 7 14 22 2 2 12 19 3 20 15 18 10 8 8 8 12 5 12 18 22 7 15 16 36 21 11 11 14 8 13 12 2 5 40 14 15 2 5 11 4 12 16 11 9 9 6 6 18 16 11 15 18 13 15 8 24 19 9 5 15 18 8 13 5 31 ...
result:
ok 2498 tokens
Test #7:
score: 0
Accepted
time: 7ms
memory: 5056kb
input:
baabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabcaaaaaaaacbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabba...
output:
67 7 4 13 81 3 8 92 28 86 94 92 71 23 73 26 24 13 71 88 98 42 70 45 82 63 5 80 57 49 48 77 88 5 98 96 65 52 11 24 52 51 76 90 9 10 58 43 36 48 82 73 10 14 90 54 74 12 32 36 71 46 8 46 20 38 22 68 54 73 66 32 95 63 52 7 40 97 27 13 42 59 41 14 9 44 53 52 92 30 36 27 86 90 59 95 12 36 42 16 24 58 23 5...
result:
ok 5000 tokens
Test #8:
score: 0
Accepted
time: 30ms
memory: 4208kb
input:
caaccaaccaaccabccbaccaaccaaccaaccaaccaaccaaccabccbaccaaccaaccaaccaaccaaccaaccabccbaccaaccaaccaaccaaccaaccaaccabccbaccaaccaaccaaccaaccaaccaaccabccbaccaaccaaccaaccaaccaaccaaccabccbaccaaccaaccaaccaaccaaccaaccabccbaccaaccaaccaaccaaccaaccaaccabccbaccaaccaaccaaccaaccaaccaaccabccbaccaaccaaccaaccaaccaaccaac...
output:
10 10 11 11 11 10 10 10 8 10 11 11 9 9 10 10 10 11 10 11 9 10 10 11 11 11 10 11 11 11 11 11 11 11 11 10 10 10 10 11 11 11 10 11 10 10 10 11 10 10 10 10 10 11 11 11 11 10 11 11 11 10 11 11 11 10 10 7 11 11 10 11 10 10 11 10 11 10 10 7 11 11 10 10 11 11 10 10 2 11 11 11 5 11 11 11 11 11 10 10 10 11 11...
result:
ok 1667 tokens
Test #9:
score: 0
Accepted
time: 31ms
memory: 3924kb
input:
cabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbb...
output:
38 38 38 37 38 38 38 9 37 38 8 38 37 38 38 38 38 38 38 37 27 38 38 38 38 38 38 30 38 38 38 38 38 38 38 38 24 38 38 38 38 38 38 38 38 38 37 38 5 38 32 25 38 38 38 38 38 38 38 38 38 38 38 37 38 37 38 31 38 38 38 38 38 38 12 38 38 37 38 38 38 38 37 38 38 38 23 38 38 38 38 24 38 38 38 38 38 35 38 38 38 ...
result:
ok 1667 tokens
Test #10:
score: 0
Accepted
time: 1ms
memory: 3916kb
input:
baaabbbaaabbbbaaababbababbabbbbaaaababaababbbbababababbbaabbbaababaaaababbbaaabaaababbababaaabbabbbaaabbabbbabaabaaaababbbbabbbbbaabbabbaaaabaaabababbbaababbbaaaaaababbabaaabaaaabbbabbbaababbbbbbbbaabbbaabbabaabababbaabaabaabbbbbaaababbbbabbbababababaabbababaabbabbbbbbaaaaaaabaabbabbabaabbbbbaaaaaba...
output:
3 3 2 3
result:
ok 4 tokens
Test #11:
score: 0
Accepted
time: 179ms
memory: 3960kb
input:
abbaaabaabbbaabbabbbbbbaabbbbabbaabababaabbabbabaaabbabbbaaaabbabbaabbbabbbabbababaaaabbabbaabababbbaaababaababbabbaaabbbaabaaaaaabbbabbababaabbbbbabbbaaaaaaabbaaaabaaababbababaabaaabbbaaabbaabbabbabbbababbabbbbbbbbaabbabbbabbbbbbbababaabbbaabaabaabaaabababbaabbbbaaabbbbabbaabbbabbbababaababbabbabba...
output:
3 4 2 2 4 2 2 4 3 5 2 2 3 4 3 2 3 4 6 2 2 2 2 2 5 3 4 3 3 2 2 2 2 5 2 3 2 3 2 3 2 3 2 4 2 2 3 2 2 3 5 2 2 7 3 2 3 2 3 3 2 2 3 4 3 2 4 2 2 2 3 3 3 3 3 2 3 3 3 5 2 4 2 3 3 3 3 3 3 2 4 4 3 4 2 2 3 3 6 2 5 4 2 2 4 2 5 3 3 2 5 4 3 3 3 3 4 3 2 3 2 4 2 3 6 3 3 2 3 3 2 3 3 5 2 3 4 3 5 3 3 3 3 4 2 3 3 2 3 2 ...
result:
ok 4997 tokens
Test #12:
score: 0
Accepted
time: 87ms
memory: 4024kb
input:
lxxhwqorbxrdzedxlvymggyicczuafgyovixrzmptqfmjyjfpamcsehmfazbvfwdgeftgbtyurnnykwjhzfqqsyiyzkpwlmspjsxdkjtpgzbrvwwcjqejmuillhgtbhwtwmvhacfphrcgwoaihjzkuccmwuidivmpjcezbjywhbqtdgrhlrskcwmecflzpjbuutlocivcfvbcdvlnfchtvvcpoubnjwfwvzvpyvhkvxdmleyvucrondntpaonjybzarkgjnkuuvipkqgvwzzzopwyfnmodnmdziueescfttr...
output:
1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok 2493 tokens
Test #13:
score: 0
Accepted
time: 61ms
memory: 4016kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
849 1135 1444 1346 1445 536 3077 2631 1447 672 2214 2149 2090 4054 846 559 22 92 4224 161 2280 572 2347 2599 778 4093 750 3647 2142 642 474 1395 776 645 46 4141 2272 771 1564 207 4284 2896 3097 2829 306 1383 394 1776 1284 3933 102 510 1101 3639 1336 1292 2803 1159 601 1464 2585 673 281 1340 272 3310...
result:
ok 2478 tokens
Test #14:
score: 0
Accepted
time: 3ms
memory: 5076kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 ...
result:
ok 4999 tokens
Subtask #2:
score: 10
Accepted
Test #15:
score: 10
Accepted
time: 696ms
memory: 78244kb
input:
aabababbabbbbbbabbababaaaabababbabbbbbbabbababaaaabababbabbbbbbabbababaaaabababbabbbbbbabbababaabbbaaabbaabbbbaabbaaabbbaabababbabbbbbbabbababaaaabababbabbbbbbabbababaaaabababbabbbbbbabbababaaaabababbabbbbbbabbababaabbaaabaaaaaabaaabbaabababbabbbbbbabbababaaaabababbabbbbbbabbababaaaabababbabbbbbbabb...
output:
41 43 154 118 55 165 48 163 119 207 147 145 33 67 114 124 154 9 104 307 102 73 39 364 79 177 53 39 88 264 77 114 79 195 150 153 157 46 129 136 147 25 309 11 12 258 259 133 355 50 116 336 13 127 18 34 122 161 38 99 290 92 355 166 59 152 41 182 103 282 166 23 86 173 32 122 60 127 287 20 83 214 119 144...
result:
ok 200000 tokens
Test #16:
score: 0
Accepted
time: 669ms
memory: 78196kb
input:
beebbeebbeebbeebbeebddbeebbeebbeebbeebbeebbeebbeebbeebbeebbeebddbeebbeebbeebbeebbeebbeebbeebbeebbeebbeebddbeebbeebbeebbeebbeebbeebbeebbeebbeebbeebddbeebbeebbeebbeebbeebccbeebbeebbeebbeebbeebddbeebbeebbeebbeebbeebbeebbeebbeebbeebbeebddbeebbeebbeebbeebbeebbeebbeebbeebbeebbeebddbeebbeebbeebbeebbeebbeeb...
output:
38 55 18 35 62 44 48 20 70 35 36 42 40 11 14 13 67 54 61 70 51 27 62 18 39 52 53 53 34 57 53 46 28 22 15 64 32 44 11 11 57 35 21 45 32 39 42 27 31 51 28 31 18 12 25 41 55 37 42 17 38 33 21 29 54 15 43 24 17 42 63 19 32 49 17 21 50 62 52 56 49 56 18 24 17 22 26 18 60 31 24 59 58 69 18 16 38 39 54 48 ...
result:
ok 200000 tokens
Test #17:
score: 0
Accepted
time: 654ms
memory: 77956kb
input:
cgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagcaidiaaidiacgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccg...
output:
17 15 19 21 17 18 21 12 12 15 18 20 14 14 16 20 15 19 11 17 10 20 16 16 16 19 12 17 16 15 18 12 24 20 12 19 9 17 13 21 28 10 13 17 10 14 13 24 17 17 19 24 11 18 16 14 13 13 17 13 22 21 20 14 7 11 18 15 18 12 12 12 19 14 15 16 19 20 16 23 19 16 18 13 24 22 17 13 15 21 21 22 13 21 19 20 9 20 14 14 15 ...
result:
ok 200000 tokens
Test #18:
score: 0
Accepted
time: 620ms
memory: 77932kb
input:
rprxrprmrprxrprkrprxrprmrprxrprhrprxrprmrprxrprkrprxrprmrprxrprwrprxrprmrprxrprkrprxrprmrprxrprhrprxrprmrprxrprkrprxrprmrprxrprvrprxrprmrprxrprkrprxrprmrprxrprhrprxrprmrprxrprkrprxrprmrprxrprwrprxrprmrprxrprkrprxrprmrprxrprhrprxrprmrprxrprkrprxrprmrprxrprbrprxrprmrprxrprkrprxrprmrprxrprhrprxrprmrprx...
output:
7 8 5 9 9 6 8 8 7 7 8 12 4 9 8 8 9 11 10 9 8 10 5 6 5 10 11 6 6 10 7 3 12 9 6 12 10 7 13 9 10 8 7 7 9 9 13 9 11 11 7 11 5 5 3 9 10 7 10 12 11 12 9 9 11 12 8 4 6 8 12 10 5 4 7 10 4 7 6 4 8 6 5 9 7 9 12 10 8 11 7 11 8 7 8 6 8 9 8 10 9 5 8 5 11 8 8 7 5 3 11 8 10 6 10 10 8 9 4 5 9 8 7 10 7 4 7 10 11 9 9...
result:
ok 200000 tokens
Test #19:
score: 0
Accepted
time: 312ms
memory: 78968kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998 199998...
result:
ok 200000 tokens
Test #20:
score: 0
Accepted
time: 370ms
memory: 78556kb
input:
susjsusosusjsusgsusjsusosusjsusmsusjsusosusjsusgsusjsusosusjsusnsusjsusosusjsusgsusjsusosusjsusmsusjsusosusjsusgsusjsusosusjsusysusjsusosusjsusgsusjsusosusjsusmsusjsusosusjsusgsusjsusosusjsusnsusjsusosusjsusgsusjsusosusjsusmsusjsusosusjsusgsusjsusosusjsusisusjsusosusjsusgsusjsusosusjsusmsusjsusosusj...
output:
11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 ...
result:
ok 200000 tokens
Subtask #3:
score: 10
Accepted
Test #21:
score: 10
Accepted
time: 2664ms
memory: 8560kb
input:
abbaaaabbabaaaaaabaabbaabbababbaaabbabbbabaabaabaaaaabaabbbbabbabbabbbababbbababababbbbabaabbaaababbbbbababbbbaabbbaaabaababababaabbbbbbaababaabbaaabaabbaaababbabbabbbbaaaaabaaabbbabbbbbbabbbabbabaabbbbbbbaaaabbaaaababbbaaaaaaababaabbbbaaabaaabbaabbbbbbababbaabbaaabbabbbbbabaababbaabaaaabbbbabababba...
output:
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 8 8 8 8 ...
result:
ok 198 tokens
Test #22:
score: 0
Accepted
time: 108ms
memory: 10332kb
input:
abbaababbabababbbbabababbbaaaabababbbbaabaabbbbabbbabbaabababbbabaaabbabbaabbbbbbaaababaababbbaabbbbaabbbaaaaaabaabbaabbaaaabaaabbaabbbaabbbababbbabbaaababaabaaabaabbabababaaaabaabbbbaaabbbbbbabbbbababbaabaabbbbabbaaabbaabaabbaabaabaaaaaabbaaabbbbbabbbbbaaabbabbabbaababaaabbabbaaaaaabbababbbaabbaabb...
output:
2 6 2 2 3 2 2 3 4 3 4 3 2 8 2 3 2 4 4 4 3 2 4 3 4 4 2 3 3 3 3 2 13 4 2 5 5 3 3 2 2 4 2 3 3 4 3 2 2 3 3 2 2 6 3 4 3 3 2 2 2 3 2 3 3 4 3 2 2 3 2 4 3 5 5 3 3 2 2 3 3 2 3 4 5 2 2 3 2 5 3 2 5 3 5 3 3 2 5 3 3 4 4 2 2 3 4 2 2 2 2 3 3 2 2 5 3 2 3 3 4 2 6 3 2 13 2 2 2 3 2 2 4 2 3 2 3 3 4 4 5 4 3 2 12 2 2 3 2...
result:
ok 199806 tokens
Test #23:
score: 0
Accepted
time: 106ms
memory: 10556kb
input:
bbabbbaaaaabbbbabaabbaabbaabbbaabbabaaabaaabbbbabbbabaabbbbbbbabbbaabbbabbabaabababaaababaabaaabaabbbabbbbbabbbbbbbbbbbaaabaaaaabaaaaababbaaaaabbabaaabbabaabababaabbbabbbbaabaabbaaabaabbaabbbbbababbabaabbbbaaabaaaababbabbaaaabbabaabbabbbbbababbabbbaaabababbababbbaabbbbabbbbaaabbabbaaabbaaababbabaaab...
output:
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
result:
ok 199800 tokens
Test #24:
score: 0
Accepted
time: 105ms
memory: 10308kb
input:
bababaaaaabbabbbbababbbbbbababbbbbaaaabbabbbbabaaababbababbaaabbabababbabbaabbabbbaababbbabaaaabbabbababbabbbabababbabbaabbbaabaabaabbbaabbabbabbababbabbaaabbbabababababaababaababbbaaababbbaababbbbabaaabaaabbababaaabbbbbaabababbbbbaabaaaaababaaabaababbaaababbbbabbbbbaababbababbbbabaabbabbbabaaaabbbb...
output:
3 2 2 2 4 2 2 4 2 3 2 4 4 2 3 2 2 2 3 3 3 3 3 2 4 5 4 2 3 2 3 2 3 2 2 3 3 3 3 3 3 3 2 3 2 3 3 3 2 4 3 3 2 2 3 5 2 3 3 3 3 2 4 4 3 2 2 2 7 3 3 2 4 2 5 5 4 3 2 4 2 2 2 2 3 4 2 6 5 3 2 4 3 3 3 3 5 3 4 2 2 2 2 2 3 2 3 3 4 5 3 2 2 2 2 3 5 2 4 2 3 2 5 3 2 3 2 3 3 2 3 2 2 2 3 2 2 2 3 3 4 2 4 4 3 5 5 3 4 2 ...
result:
ok 199800 tokens
Test #25:
score: 0
Accepted
time: 2662ms
memory: 8460kb
input:
aaabaaababbbabaaaababbbaabaaaabababaaabbaaaabbbbbabbaabbbbbbabbabbbaabaaaabbbabbbbbbbbaabbaaaaaabbabbaabbaaaaaabaaaabbbbbbaabbaabaaabbbaaaaaaabbbabaaaaabbbabbbaaabaaaabababaaaaaaabaaabaababbbbabbbabbbaabbbbaaaabbbbaababaababaaabbaabbbaabbabaabaaabbabaaababbaaaaabaaaabbbbabaaabbbaaaaabababbabaabbabab...
output:
3 2 3 3 2 2 3 3 2 4 2 4 3 4 3 2 3 2 2 4 2 2 2 3 2 3 2 2 2 3 4 4 3 2 2 6 2 4 3 4 4 3 2 2 5 2 2 3 4 3 3 3 7 4 3 4 3 2 4 4 4 4 3 3 3 2 2 2 3 3 2 3 6 2 2 3 3 2 2 2 2 2 2 3 2 3 2 5 4 3 3 3 2 3 3 4 2 2 4 4 2 3 3 2 6 3 2 3 4 3 2 3 3 2 3 2 2 3 4 3 4 3 2 3 3 2 2 2 3 5 2 3 3 3 2 2 2 4 2 2 4 3 2 2 3 3 3 2 2 2 ...
result:
ok 211 tokens
Test #26:
score: 0
Accepted
time: 101ms
memory: 10380kb
input:
ababaaabaabbbaabbaabaaaabaaabaabbababbababaabbaabbbbaaabaabaabaaaabaababbbaabbabbaaabaabbaabababbbababbabaaaabbabbbbbbaabababbbbababbaaabaaababbbbaabbaaaabbbbaaabbbabbabbaabbbbababbaabaabbabbababbabbaababbbaaaaababbaabbbbabaabbbabbbbbaaababbaaabbbbaaababbaababaaabaaabaababbabaabaabbbbaaaaabbababaaab...
output:
3 2 2 3 3 5 3 4 3 3 2 3 4 2 3 4 3 3 3 2 3 4 2 4 2 3 2 2 2 3 3 4 3 2 3 3 4 4 3 2 3 3 3 2 3 2 3 3 5 2 2 2 4 3 3 2 2 2 5 4 3 7 2 3 2 5 3 2 3 3 3 3 3 2 2 4 3 3 2 2 2 2 3 2 7 3 2 3 3 2 2 3 2 2 3 3 4 3 4 3 4 3 2 2 3 3 3 4 3 5 5 2 2 3 4 5 3 3 5 3 2 2 3 2 8 3 5 5 3 3 2 3 4 2 2 4 2 2 2 2 2 4 4 3 4 3 3 2 3 2 ...
result:
ok 199782 tokens
Subtask #4:
score: 0
Runtime Error
Test #27:
score: 10
Accepted
time: 1369ms
memory: 9516kb
input:
babbaaabbbbbbbabbbababaabbbbbababababbaabaabbbbbbabbbbbbbbbbababbbbabbaabbbaabaabbabbbaabbabbbabbababaababbbabbbbaabbabbabbaaaabbbaaabbbbaabbaaaaaaabbbabbbaaabaababaaabaaaabaaaababaaaaababaaaabaabbaaaabbbabbaabaabbbabbbbbaaabaababbbaaaaabbbbaaabbbbaabbabbbbabbbabbaaaaabaabaaaabbbabbbbbaabbbbabbbbaab...
output:
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 ...
result:
ok 100490 tokens
Test #28:
score: -10
Runtime Error
input:
lqdvhpozemuhtibmunxftkdjjdktfxnumbithumezophvdqllqdvhpozemuhtibmunxftkdjjdktfxnumbithumezophvdqlfibyjjybiflqdvhpozemuhtibmunxftkdjjdktfxnumbithumezophvdqllqdvhpozemuhtibmunxftkdjjdktfxnumbithumezophvdqlewwelqdvhpozemuhtibmunxftkdjjdktfxnumbithumezophvdqllqdvhpozemuhtibmunxftkdjjdktfxnumbithumezophvd...
output:
2 2 0 0 0 0 0 0 0 2 2 3 0 0 0 0 0 0 0 0 3 3 2 2 0 0 2 0 2 3 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 2 3 2 2 0 0 0 0 0 0 0 0 0 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 2 3 3 3 3 3 3 3 2 0 2 2 2 2 2 2 0 0 0 0 0 0 0 0 0 3 2 2 0 0 0 0 0 0 0 0 2 0 0 0 0 0 3 3 3 0 0 0 0 0 0 2 3 0 0 0 0 0 0 0 1 0 0 0 0 ...
result:
Subtask #5:
score: 0
Runtime Error
Dependency #1:
100%
Accepted
Test #35:
score: 0
Runtime Error
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
result:
Subtask #6:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
0%