QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#600359 | #9425. Generated String | hos_lyric | AC ✓ | 1947ms | 188712kb | C++14 | 13.7kb | 2024-09-29 16:06:43 | 2024-09-29 16:06:43 |
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")
// Each operation consists of disjoint pairs (compare and swap).
// Batcher's algorithm
// (1 + 2 + ... + ceil(log_2(n))) operations
vector<vector<pair<int, int>>> parallelSort(int n) {
assert(n >= 0);
vector<vector<pair<int, int>>> ops;
for (int m = 1; m < n; m <<= 1) {
// sorted blocks of m elements
for (int d = m; d >= 1; d >>= 1) {
// operate on pairs of distance d
ops.emplace_back();
for (int i = 0; i < n; i += (m << 1)) {
for (int j = i + d % m; j + d < i + (m << 1); j += (d << 1)) {
for (int k = j; k < j + d && k + d < n; ++k) {
ops.back().emplace_back(k, k + d);
}
}
}
}
}
return ops;
}
// point add, rectangle sum
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 X x = yx.second;
const Y 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(X x, Y 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(X x0, X x1, Y y0, Y 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, Y y0, Y 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;
}
};
////////////////////////////////////////////////////////////////////////////////
// SA-IS
// String: string, vector<int>, vector<long long>
// if sigma <= n, O(n) time, O(n) space
// if sigma > n, O(n log n) time, O(n) space
template <class String> vector<int> suffixArrayRec(const String &as) {
const int n = as.size();
if (n == 0) return {};
const auto minmaxA = minmax_element(as.begin(), as.end());
const auto minA = *minmaxA.first, maxA = *minmaxA.second;
if (static_cast<unsigned long long>(maxA) - minA >=
static_cast<unsigned long long>(n)) {
vector<int> us(n);
for (int u = 0; u < n; ++u) us[u] = u;
std::sort(us.begin(), us.end(), [&](int u, int v) -> bool {
return (as[u] < as[v]);
});
int b = 0;
vector<int> bs(n, 0);
for (int i = 1; i < n; ++i) {
if (as[us[i - 1]] != as[us[i]]) ++b;
bs[us[i]] = b;
}
return suffixArrayRec(bs);
}
const int sigma = maxA - minA + 1;
vector<int> pt(sigma + 1, 0), poss(sigma);
for (int u = 0; u < n; ++u) ++pt[as[u] - minA + 1];
for (int a = 0; a < sigma; ++a) pt[a + 1] += pt[a];
// cmp[u] := (as[u, n) < as[u + 1, n))
vector<bool> cmp(n);
cmp[n - 1] = false;
for (int u = n - 1; --u >= 0; ) {
cmp[u] = (as[u] != as[u + 1]) ? (as[u] < as[u + 1]) : cmp[u + 1];
}
// ><, nn - id (0 <= id < n)
int nn = 0;
vector<int> ids(n, 0);
int last = n;
vector<int> nxt(n, 0);
// put ><, from the tail of each bucket
vector<int> us(n, 0);
memcpy(poss.data(), pt.data() + 1, sigma * sizeof(int));
for (int u = n - 1; --u >= 1; ) if (!cmp[u - 1] && cmp[u]) {
ids[u] = ++nn;
nxt[u] = last;
last = u;
us[--poss[as[u] - minA]] = u;
}
// follow > backwards, from the head of each bucket
memcpy(poss.data(), pt.data(), sigma * sizeof(int));
us[poss[as[n - 1] - minA]++] = n - 1;
for (int i = 0; i < n; ++i) {
const int u = us[i];
if (u && !cmp[u - 1]) us[poss[as[u - 1] - minA]++] = u - 1;
}
// follow < backwards, from the tail of each bucket
memcpy(poss.data(), pt.data() + 1, sigma * sizeof(int));
for (int i = n; --i >= 0; ) {
const int u = us[i];
if (u && cmp[u - 1]) us[--poss[as[u - 1] - minA]] = u - 1;
}
if (nn) {
int vsLen = 0;
vector<int> vs(nn);
for (const int u : us) if (ids[u]) vs[vsLen++] = u;
int b = 0;
vector<int> bs(nn, 0);
for (int j = 1; j < nn; ++j) {
// as[v1, w1] (< or =) as[v0, w0]
int v1 = vs[j - 1], v0 = vs[j];
const int w1 = nxt[v1], w0 = nxt[v0];
if (w1 - v1 != w0 - v0) {
++b;
} else {
for (; ; ++v1, ++v0) {
if (v1 == n) { ++b; break; }
if (as[v1] != as[v0]) { ++b; break; }
if (v1 == w1) break;
}
}
bs[nn - ids[vs[j]]] = b;
}
for (int u = 0; u < n; ++u) if (ids[u]) vs[nn - ids[u]] = u;
const auto sub = suffixArrayRec(bs);
// put ><, from the tail of each bucket
memset(us.data(), 0, n * sizeof(int));
memcpy(poss.data(), pt.data() + 1, sigma * sizeof(int));
for (int j = nn; --j >= 0; ) {
const int u = vs[sub[j]];
us[--poss[as[u] - minA]] = u;
}
// follow > backwards, from the head of each bucket
memcpy(poss.data(), pt.data(), sigma * sizeof(int));
us[poss[as[n - 1] - minA]++] = n - 1;
for (int i = 0; i < n; ++i) {
const int u = us[i];
if (u && !cmp[u - 1]) us[poss[as[u - 1] - minA]++] = u - 1;
}
// follow < backwards, from the tail of each bucket
memcpy(poss.data(), pt.data() + 1, sigma * sizeof(int));
for (int i = n; --i >= 0; ) {
const int u = us[i];
if (u && cmp[u - 1]) us[--poss[as[u - 1] - minA]] = u - 1;
}
}
return us;
}
// us[i]: i-th suffix
// su[u]: index of as[u, n)
// hs[i]: longest common prefix of as[us[i - 1], n) and as[us[i], n)
struct SuffixArray {
int n;
bool rmq;
vector<int> us, su, hs;
SuffixArray() : n(0), rmq(false) {}
SuffixArray(const string &as, bool rmq_) : rmq(rmq_) { build(as); }
SuffixArray(const vector<int> &as, bool rmq_) : rmq(rmq_) { build(as); }
SuffixArray(const vector<long long> &as, bool rmq_) : rmq(rmq_) { build(as); }
template <class String> void build(const String &as) {
n = as.size();
us = suffixArrayRec(as);
su.resize(n + 1);
for (int i = 0; i < n; ++i) su[us[i]] = i;
su[n] = -1;
hs.assign(n, 0);
for (int h = 0, u = 0; u < n; ++u) if (su[u]) {
for (int v = us[su[u] - 1]; v + h < n && as[v + h] == as[u + h]; ++h) {}
hs[su[u]] = h;
if (h) --h;
}
if (rmq) {
const int logN = n ? (31 - __builtin_clz(n)) : 0;
hs.resize((logN + 1) * n - (1 << logN) + 1);
for (int e = 0; e < logN; ++e) {
int *hes = hs.data() + e * n;
for (int i = 0; i <= n - (1 << (e + 1)); ++i) {
hes[n + i] = min(hes[i], hes[i + (1 << e)]);
}
}
}
}
// Returns longest common prefix of as[u, n) and as[v, n).
// 0 <= u, v <= n
// Assumes rmq.
inline int lcp(int u, int v) const {
if (u == v) return n - u;
int i = su[u], j = su[v];
if (i > j) swap(i, j);
const int e = 31 - __builtin_clz(j - i);
return min(hs[e * n + i + 1], hs[e * n + j + 1 - (1 << e)]);
}
// !
int cmp(const vector<pair<int, int>> &as, const vector<pair<int, int>> &bs) const {
const int asLen = as.size(), bsLen = bs.size();
int i = 0, j = 0;
pair<int, int> a(0, 0), b(0, 0);
for (; ; ) {
for (; i < asLen && a.first == a.second; ++i) a = as[i];
for (; j < bsLen && b.first == b.second; ++j) b = bs[j];
if (a.first == a.second) {
if (b.first == b.second) {
return 0;
} else {
return -1;
}
} else {
if (b.first == b.second) {
return +1;
} else {
const int m = min(a.second - a.first, b.second - b.first);
const int l = lcp(a.first, b.first);
if (l < m) {
return (su[a.first + l] < su[b.first + l]) ? -1 : +1;
} else {
a.first += m;
b.first += m;
}
}
}
}
}
};
////////////////////////////////////////////////////////////////////////////////
using VP = vector<pair<int, int>>;
void readVP(VP &vp) {
int len;
scanf("%d", &len);
vp.resize(len);
for (int i = 0; i < len; ++i) {
scanf("%d%d", &vp[i].first, &vp[i].second);
--vp[i].first;
}
}
int N, Q;
char S[100'010];
vector<char> O;
vector<VP> A, B;
vector<int> T;
vector<int> L[2], R[2];
void rev(VP &vp) {
reverse(vp.begin(), vp.end());
for (auto &lr : vp) {
lr = make_pair(N - lr.second, N - lr.first);
}
}
int main() {
for (; ~scanf("%d%d", &N, &Q); ) {
scanf("%s", S);
O.resize(Q);
A.assign(Q, {});
B.assign(Q, {});
T.assign(Q, -1);
for (int q = 0; q < Q; ++q) {
scanf(" %c", &O[q]);
if (false) {
} else if (O[q] == '+') {
readVP(A[q]);
} else if (O[q] == '-') {
scanf("%d", &T[q]);
--T[q];
} else if (O[q] == '?') {
readVP(A[q]);
readVP(B[q]);
} else {
assert(false);
}
}
// sort by 0: prefix, 1: suffix
for (int dir = 0; dir < 2; ++dir) {
string cat = S;
if (dir) {
reverse(cat.begin(), cat.end());
}
cat += '~';
const SuffixArray sa(cat, true);
vector<pair<VP, int>> ps;
for (int q = 0; q < Q; ++q) {
if (O[q] == '+') {
ps.emplace_back(A[q], q);
if (dir) rev(ps.back().first);
}
if (O[q] == '?') {
VP vp = dir ? B[q] : A[q];
if (dir) rev(vp);
ps.emplace_back(vp, -Q + q);
vp.emplace_back(N, N + 1);
ps.emplace_back(vp, +Q + q);
}
}
// for(auto&p:ps){for(auto&lr:p.first)cerr<<cat.substr(lr.first,lr.second-lr.first);cerr<<" "<<p.second<<endl;}cerr<<endl;
/*
sort(ps.begin(), ps.end(), [&](const pair<VP, int> &p0, const pair<VP, int> &p1) -> bool {
const int res = sa.cmp(p0.first, p1.first);
return (res ? (res < 0) : (p0.second < p1.second));
});
*/
const auto para = parallelSort(ps.size());
for (const auto &ops : para) for (const auto &op : ops) {
auto &p0 = ps[op.first];
auto &p1 = ps[op.second];
const int res = sa.cmp(p0.first, p1.first);
if (res ? (res > 0) : (p0.second > p1.second)) {
swap(p0, p1);
}
}
// for(auto&p:ps){for(auto&lr:p.first)cerr<<cat.substr(lr.first,lr.second-lr.first);cerr<<" "<<p.second<<endl;}cerr<<endl;
L[dir].assign(Q, -1);
R[dir].assign(Q, -1);
for (int x = 0; x < (int)ps.size(); ++x) {
if (ps[x].second < 0) {
const int q = ps[x].second + Q;
L[dir][q] = x;
} else if (ps[x].second < Q) {
const int q = ps[x].second;
L[dir][q] = x;
} else {
const int q = ps[x].second - Q;
R[dir][q] = x;
}
}
}
Bit2d<int, int, int> bit;
for (int q = 0; q < Q; ++q) {
if (O[q] == '+') {
bit.book(L[0][q], L[1][q]);
}
}
bit.build();
for (int q = 0; q < Q; ++q) {
if (false) {
} else if (O[q] == '+') {
bit.add(L[0][q], L[1][q], +1);
} else if (O[q] == '-') {
bit.add(L[0][T[q]], L[1][T[q]], -1);
} else if (O[q] == '?') {
const int ans = bit.get(L[0][q], R[0][q], L[1][q], R[1][q]);
printf("%d\n", ans);
} else {
assert(false);
}
}
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3864kb
input:
8 7 abcaabbc + 3 1 3 2 4 3 8 + 2 1 4 1 8 + 1 2 4 ? 1 5 6 1 7 8 - 3 + 1 2 5 ? 1 2 3 1 5 5
output:
2 1
result:
ok 2 lines
Test #2:
score: 0
Accepted
time: 6ms
memory: 4372kb
input:
5 2000 bbaab + 1 3 5 + 2 5 5 3 5 - 2 ? 1 1 3 3 3 3 4 5 2 5 - 1 ? 3 1 1 2 4 1 5 1 3 4 ? 1 1 2 2 2 4 4 4 ? 1 1 5 1 5 5 + 3 1 2 1 5 1 4 ? 2 1 5 1 3 2 1 2 5 5 ? 1 3 4 1 4 5 - 9 ? 1 1 4 1 2 3 + 2 1 5 1 2 + 1 1 4 - 15 - 14 ? 2 2 5 2 5 1 3 4 + 1 2 3 - 19 + 3 1 4 1 5 4 5 - 21 + 1 2 5 ? 3 1 5 5 5 1 5 1 3 5 ?...
output:
0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 2 0 3 1 0 0 0 0 1 0 0 0 0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1 0 0 0 4 0 3 0 0 0 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 2 0 8 0 0 0 0 0 0 0 2 0 0 ...
result:
ok 33212 lines
Test #6:
score: 0
Accepted
time: 1616ms
memory: 94084kb
input:
100000 100000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
0 1 0 1 0 1 0 5 0 4 1 1 1 1 2 0 3 0 0 0 0 1 1 0 0 2 2 0 0 1 5 1 0 0 3 3 5 2 5 0 8 2 2 2 13 2 2 0 2 4 11 9 5 3 14 4 9 19 12 4 12 11 6 7 8 2 22 7 3 20 7 9 6 0 5 5 17 2 9 9 0 2 7 10 11 0 9 3 4 5 12 6 10 0 2 21 2 9 1 3 1 2 2 10 22 8 21 4 3 16 3 8 2 12 9 0 2 12 4 5 19 16 7 5 4 4 3 8 5 11 4 6 5 13 0 6 5 1...
result:
ok 33583 lines
Test #7:
score: 0
Accepted
time: 723ms
memory: 96388kb
input:
100000 100000 baabbabaabaaaabbaaababaaabbbbbaabbababbabbbaabbaaabbbbababaababbbbbababaabaaabaaababaabbbbaaababbbbabaabbaaaaaabbbabbbabababababaabbabbbbbaaabababbbaabababbbaaababaabbaaaabbabbaabbababaabbaaaababaabbbbbababbaaabbbaababbaaaaaabbbbabbbbbbabbaabababbbaaaaaabbabbabaaaaaabbbaaaaaabaabaaabab...
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 33381 lines
Test #8:
score: 0
Accepted
time: 1806ms
memory: 96412kb
input:
100000 100000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
2 2 0 2 1 1 2 2 2 2 0 0 0 0 0 1 0 0 1 0 0 0 2 2 2 0 1 0 0 0 0 1 0 2 3 0 1 0 1 0 0 1 1 2 2 2 1 1 1 0 0 0 2 0 3 0 0 0 0 0 1 2 0 0 1 1 0 0 0 1 1 2 0 2 1 2 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1 2 2 1 2 4 3 2 0 2 0 0 1 4 0 0 1 1 5 1 0 1 0 0 2 1 0 3 3 1 0 1 1 2 2 3 0 1 3 7 6 0 7 1 1 1 5 2 5 0 2 6 2 2 2 5 ...
result:
ok 33565 lines
Test #9:
score: 0
Accepted
time: 685ms
memory: 96228kb
input:
100000 100000 aaabbbabbaababbbbbbaaababbbaaaaaabbaaaabababbabababbabbabbbaababbbbabaabaaabbaaabbabababbaaabbabbaaaaabbabababbaaaaababbbbabbabaaabbbaabaabbbaaababbbbbabaaabaaaaabbaabaabbabababbabaaabbbbbbbbaababaabbbabaabbabaaabbbbbababaaabbbbbaaaaaaabbbabbbaabbaabbaaaaaaabbbaabbbaabbaaaababbabaababb...
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 33118 lines
Test #10:
score: 0
Accepted
time: 1574ms
memory: 96172kb
input:
100000 100000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
0 1 0 0 0 2 0 0 0 0 0 0 0 1 0 0 1 0 0 3 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 4 0 1 0 0 0 0 2 0 3 4 4 5 8 7 9 5 0 9 3 8 2 9 0 5 7 1 7 9 0 1 4 1 5 8 5 1 0 0 5 0 4 12 0 9 5 11 10 3 1 8 1 9 2 1 0 5 5 5 0 2 5 1 1 0 0 12 8 11 11 1 4 11 10 3 7 9 9 4 12 11 5 9 6 1 2 8 10 11 4 17 11 6 3 2 4 1 1 3 1 3 2 3 6 5 4 8 12...
result:
ok 33215 lines
Test #11:
score: 0
Accepted
time: 630ms
memory: 96312kb
input:
100000 100000 mwtmtwnsgaynckkprtjhfnmyzylblnkmrismcyyksqxcikyhrsannbmflvloshydnfvydmuoyphxpjgxsfmyqozidivsigleuvmnyniccdqjekyzjtytudpjbwjmsulfipurvjuxququmkfbrigctewalryoiilmqapofcwpllcwjnzmbtirmfmyhbuqkwqhzidrqbxnulklkjmrnzzclykjoflrbimnshtruucmjiukgvzoekyjnjpkkpwcgrbidyuyodlqaaywfsnbcczuxwsbnrcprq...
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 33475 lines
Test #12:
score: 0
Accepted
time: 1440ms
memory: 94112kb
input:
100000 100000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
0 0 1 1 1 1 3 1 3 4 3 3 4 5 7 4 4 4 5 3 4 6 1 0 4 4 12 3 9 9 9 3 7 10 6 9 2 9 4 8 8 7 4 7 7 6 1 5 6 6 4 5 4 3 0 1 1 1 0 0 0 0 0 0 0 0 0 1 0 1 1 0 2 0 0 0 0 0 0 0 0 0 0 1 0 1 1 3 1 1 1 4 4 1 0 4 3 2 0 2 1 0 0 0 0 6 5 0 2 4 2 0 0 0 0 1 0 1 0 0 0 2 4 4 1 3 5 1 0 0 0 0 0 0 2 2 2 0 0 0 0 0 0 0 0 2 2 3 1 ...
result:
ok 33689 lines
Test #13:
score: 0
Accepted
time: 1063ms
memory: 95900kb
input:
100000 100000 bbbbbaabbbbbaaabaabaaabbbbaabaaabaabbababbaaaaaaaabbababbbbabbababaabbabaabbaaaabbbbabaabbababbbbbbbaaabaabbabbbbbbaaaaababaaabbbabbaabaabaaabbbabbaaabaaaababbaaabaabbabaaaaaaababababbbbaabbaaaabaabbbbaaaababbabbbbabaabbbaaabbbaabaaabbbaaabaabbbbbabbaaabbaabbabbaababbbabbababbabbaabbbb...
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 33438 lines
Test #14:
score: 0
Accepted
time: 614ms
memory: 94604kb
input:
100000 100000 aaabbbbabbaababbabaabbabababaaaaabbababababaabbaaabbbaaaaaabaaabbabbabbbabaabbaabbabbbbbbbaabaaababaaaaabaaaabbbaaaabbaabbaabbbbaaababbabababbaaaaabbbababababaabaabababbabbbbbabbabbbbaaabab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
ok 525 lines
Test #16:
score: 0
Accepted
time: 1704ms
memory: 159024kb
input:
100000 100000 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm...
output:
0 0 0 1 0 0 0 2 0 0 0 0 2 0 0 0 0 1 0 0 2 0 0 1 1 1 1 0 1 2 2 0 2 1 1 1 0 2 1 1 1 1 1 1 0 2 3 3 1 1 1 1 4 1 3 4 0 2 2 2 2 3 2 3 2 0 2 1 3 4 4 3 1 4 2 0 0 3 2 3 3 3 2 3 0 3 3 3 3 3 5 4 0 4 3 4 3 4 4 1 3 3 4 5 4 5 1 6 5 6 8 6 3 6 8 6 3 5 2 1 6 4 3 6 3 1 1 3 4 3 5 8 4 3 5 6 3 6 1 7 3 7 8 6 4 7 4 3 1 5 ...
result:
ok 49940 lines
Test #17:
score: 0
Accepted
time: 1405ms
memory: 95432kb
input:
100000 100000 dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...
output:
0 6 5 7 5 8 6 6 17 13 14 20 26 23 16 21 20 17 39 26 31 32 46 39 36 52 36 28 28 28 26 29 46 53 48 55 18 43 44 40 49 25 59 42 57 60 42 36 65 50 52 59 25 56 42 42 16 77 43 42 65 57 57 52 44 48 42 19 43 72 65 56 101 69 37 69 73 106 72 55 66 22 70 60 40 73 81 78 60 79 94 63 74 62 74 78 110 76 107 113 108...
result:
ok 9964 lines
Test #18:
score: 0
Accepted
time: 1947ms
memory: 185056kb
input:
100000 100000 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
output:
0 0 1 1 0 0 0 2 2 0 0 1 2 2 0 0 3 3 3 2 0 1 3 0 1 0 2 1 1 1 2 5 4 3 4 3 3 1 3 1 2 1 5 2 3 2 3 5 2 5 3 1 5 3 1 3 1 1 2 4 4 1 5 1 1 2 3 3 3 4 2 5 3 2 2 4 4 2 4 3 3 5 4 7 4 8 6 8 5 4 4 4 6 3 4 7 5 4 9 6 6 5 7 7 5 6 6 5 5 5 6 8 6 5 5 4 7 4 7 4 4 5 4 5 4 8 4 4 5 5 4 8 4 8 8 8 4 7 9 5 7 6 7 6 6 6 8 6 10 6...
result:
ok 90061 lines
Test #19:
score: 0
Accepted
time: 1672ms
memory: 175248kb
input:
100000 100000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
0 0 0 0 0 0 0 0 0 0 0 1 0 0 3 0 0 1 0 1 0 0 1 3 2 0 2 3 1 0 2 3 0 0 0 0 3 3 3 0 5 2 0 3 0 1 3 1 0 1 1 0 3 3 3 0 6 3 0 3 0 0 1 3 3 2 3 4 0 1 3 1 3 1 1 6 5 4 8 2 1 3 4 3 0 0 6 8 10 1 4 11 2 4 0 0 0 4 3 9 3 2 10 10 7 3 1 1 3 8 5 0 3 1 8 1 3 0 8 1 6 1 4 1 8 8 6 1 7 0 1 6 9 1 6 4 3 1 2 6 7 1 9 10 3 7 2 2...
result:
ok 49932 lines
Test #20:
score: 0
Accepted
time: 1324ms
memory: 98552kb
input:
100000 100000 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...
output:
1 1 1 0 1 2 2 1 4 4 4 6 6 7 7 9 12 12 11 15 8 21 3 4 8 8 26 11 15 11 20 21 22 29 14 26 25 31 34 26 19 11 29 33 17 20 20 27 33 29 29 43 31 33 33 16 35 30 17 24 40 36 41 19 33 38 51 32 64 28 21 50 42 41 46 29 48 51 62 56 30 45 62 37 54 38 22 43 38 45 43 40 59 53 73 73 72 45 68 27 68 64 62 72 51 65 39 ...
result:
ok 10030 lines
Test #21:
score: 0
Accepted
time: 1757ms
memory: 185832kb
input:
100000 100000 pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp...
output:
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 1 1 2 0 0 0 1 1 1 1 1 0 1 3 1 1 1 2 0 1 2 3 3 0 1 1 1 1 1 1 2 2 2 0 2 3 1 1 1 1 0 1 1 0 2 0 2 0 1 0 2 3 2 1 1 1 1 1 5 3 0 2 2 2 0 2 2 2 1 2 4 5 2 2 5 2 1 2 5 0 2 5 3 5 5 0 2 2 3 0 4 2 4 0 2 1 2 1 2 2 1 0 2 1 3 1 0 2 0 2 2 0 3 3 3 5 2 2 5 3 6 5 3 3 ...
result:
ok 90160 lines
Test #22:
score: 0
Accepted
time: 883ms
memory: 158196kb
input:
100000 100000 faxyuxswncplvrzynzvlbjqvkdhqfmdddimahxygchjxwqaouebuiijkydypsvhlqeoelcnizmzcnuzvxzqilitcmbrhwjtbastbqyktczoarrihswnbsjtzvkrdjkwzijqkcziwqndcfgyvpepsokrgtlvrwxwjbtctdluemgbpzneomxcqdxxaoxdrgdzrherrygznacprcimyudgbjpelkpxotckckzihjuxnlmkczsutackpunsfnkwvhkadjfnhmvplqfgzmkssoacpuxaipepwro...
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 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 2 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 1 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 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 1 0 ...
result:
ok 49806 lines
Test #23:
score: 0
Accepted
time: 847ms
memory: 101576kb
input:
100000 100000 twdczjujsjrmpsipsunndczjujsjrmpsipsuwynwdczjujsjrmpsipsuwjwdczjujsjrmpsipsuyhtwdczjujsjrmpsipsuwwddczjujsjrmpsipsudczjujsjrmpsipsuybtwdczjujsjrmpsipsuwexdczjujsjrmpsipsuwevtwdczjujsjrmpsipsuwexatwdczjujsjrmpsipsuapwdczjujsjrmpsipsuwepwdczjujsjrmpsipsuwowdczjujsjrmpsipsudczjujsjrmpsipsu...
output:
0 1 0 0 0 1 0 0 1 1 7 0 0 0 0 3 3 0 3 3 1 1 0 0 0 0 0 3 9 13 0 14 5 0 2 10 6 5 2 9 3 9 3 5 6 2 1 0 4 2 1 0 0 10 3 5 2 0 7 0 30 27 0 3 13 0 0 0 1 0 22 0 0 1 0 0 27 0 35 1 0 1 17 0 0 0 1 10 0 0 0 2 2 15 0 52 0 4 14 0 0 36 6 0 25 0 12 0 6 1 0 1 0 0 0 3 9 2 0 60 38 16 15 11 0 0 0 2 13 0 0 6 0 7 0 0 0 25...
result:
ok 9909 lines
Test #24:
score: 0
Accepted
time: 985ms
memory: 188320kb
input:
100000 100000 gqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxi...
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 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 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 6 6 6 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 9 9 9 10 10 11 11 11 11 11 11 11 11 12 12 12 12 12 12 13 13 13 13 13 13 13 14 14 14 15 15 15 15 15 1...
result:
ok 90066 lines
Test #25:
score: 0
Accepted
time: 1045ms
memory: 141776kb
input:
100000 100000 nbaiostoyrvtrkngnuatnddlyjzqnfgufkqtmahrkmxxstxnqszjxibrnymsyujvzvazdmernpfoapfefjnbberzsmfmfqjwyyrqmbgdzppkratnddlyjzqnfgufkqtmahrkmxxstxnqszjxibrnymsyujvzvazdmernpfoapfefjnbberzsmfmfqjwyyrqvazynjzqnfgufkqtmahrkmxxstxnqszjxibrnymsyujvzvazdmernpfoapfefjnbberzsjzqnfgufkqtmahrkmxxstxnqsz...
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 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 ...
result:
ok 50106 lines
Test #26:
score: 0
Accepted
time: 879ms
memory: 103272kb
input:
100000 100000 avrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpo...
output:
2 2 13 28 31 64 83 95 108 119 121 127 134 141 157 158 162 164 175 181 181 195 201 201 209 210 215 218 253 259 263 263 273 274 280 303 310 317 318 325 328 342 360 368 376 392 393 420 427 431 434 440 456 457 485 501 502 533 556 593 601 601 605 606 614 617 644 654 687 700 721 723 728 728 731 731 738 74...
result:
ok 9852 lines
Test #27:
score: 0
Accepted
time: 1179ms
memory: 188712kb
input:
100000 100000 nzqcglfwczqmzqcglfwczazqcglfwczzmzqcglfwczzqcglfwczpmzqcglfwczzqcglfwcxmzqcglfwcznzqcglfwczqcglfwcmzqcglfwczmzqcglfwcjmzqcglfwczzqcglfwczrzqcglfwczqcglfwczqcglfwczmzqcglfwczwzqcglfwczqcglfwcjzqcglfwcmzqcglfwcmzqcglfwczzqcglfwcizqcglfwcomzqcglfwcmzqcglfwczzqcglfwcjmzqcglfwczmzqcglfwczmz...
output:
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 1 0 1 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 1 0 2 0 1 0 0 3 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 3 0 0 0 0 0 0 0 1 2 0 0 0 0 1 0 1 0 1 0 0 ...
result:
ok 90005 lines
Test #28:
score: 0
Accepted
time: 1721ms
memory: 158644kb
input:
100000 100000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
5379 21600 8676 17796 6561 7062 8794 24490 12428 13642 26349 12930 17230 4054 29012 19503 23951 2084 14612 6542 11110 18521 5532 30725 21338 30107 893 12051 20828 7845 32580 8063 4190 21112 8005 33480 15470 3466 1311 10240 13981 29868 3358 35905 19687 9180 46665 11173 4030 5610 14002 22315 28887 629...
result:
ok 49879 lines
Extra Test:
score: 0
Extra Test Passed