QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#72827#4844. Positive Stringckiseki#AC ✓1124ms118140kbC++204.6kb2023-01-19 16:43:482023-01-19 16:43:50

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-19 16:43:50]
  • 评测
  • 测评结果:AC
  • 用时:1124ms
  • 内存:118140kb
  • [2023-01-19 16:43:48]
  • 提交

answer

#include <bits/stdc++.h>
#include <bits/extc++.h>

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using rbt = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

namespace {

constexpr int maxn = 4'000'00 + 5;

namespace sfx {

bool _t[maxn * 2];
int hi[maxn], rev[maxn];
int _s[maxn * 2], sa[maxn * 2], _c[maxn * 2];
int x[maxn], _p[maxn], _q[maxn * 2];

void pre(int *a, int *c, int n, int z) {
    memset(a, 0, sizeof(int) * n);
    memcpy(x, c, sizeof(int) * z);
}

void induce(int *a, int *c, int *s, bool *t, int n, int z) {
    memcpy(x + 1, c, sizeof(int) * (z - 1));
    for (int i = 0; i < n; ++i)
        if (a[i] && !t[a[i] - 1])
            a[x[s[a[i] - 1]]++] = a[i] - 1;
    memcpy(x, c, sizeof(int) * z);
    for (int i = n - 1; i >= 0; --i)
        if (a[i] and t[a[i] - 1])
            a[--x[s[a[i] - 1]]] = a[i] - 1;
}

void sais(int *s, int *a, int *p, int *q, bool *t, int *c, int n, int z) {
    bool uniq = t[n - 1] = true;
    int nn = 0, nmxz = -1, last = -1, *nsa = a + n, *ns = s + n;
    memset(c, 0, sizeof(int) * z);
    for (int i = 0; i < n; ++i)
        uniq &= ++c[s[i]] < 2;
    for (int i = 0; i < z - 1; ++i)
        c[i + 1] += c[i];
    if (uniq) {
        for (int i = 0; i < n; ++i) a[--c[s[i]]] = i;
        return;
    }
    for  (int i = n - 2; i >= 0; --i)
        t[i] = (s[i] == s[i + 1] ? t[i + 1] : s[i] < s[i + 1]);
    pre(a, c, n, z);
    for (int i = 1; i <= n - 1; ++i)
        if (t[i] and not t[i - 1])
            a[--x[s[i]]] = p[q[i] = nn++] = i;
    induce(a, c, s, t, n, z);
    for (int i = 0; i < n; ++i) {
        if (a[i] and t[a[i]] and !t[a[i] - 1]) {
            bool neq = last < 0 or memcmp(s + a[i], s + last, (p[q[a[i]] + 1] - a[i]) * sizeof(int));
            ns[q[last = a[i]]] = nmxz += neq;
        }
    }
    sais(ns, nsa, p + nn, q + n, t + n, c + z, nn , nmxz + 1);
    pre(a, c, n, z);
    for (int i = nn - 1; i >= 0; --i)
        a[--x[s[p[nsa[i]]]]] = p[nsa[i]];
    induce(a, c, s, t, n, z);
}

void build(const string &s) {
    const int n = int(s.size());
    for (int i = 0; i < n; ++i)
        _s[i] = s[i];
    _s[n] = 0;
    sais(_s, sa, _p, _q, _t, _c, n + 1, 128);
    for (int i = 0; i < n; ++i)
        rev[sa[i] = sa[i + 1]] = i;
    int ind = hi[0] = 0;
    for (int i = 0; i < n; ++i) {
        if (!rev[i]) {
            ind = 0;
            continue;
        }
        while (i + ind < n && s[i + ind] == s[sa[rev[i] - 1] + ind])
            ++ind;
        hi[rev[i]] = ind ? ind-- : 0;
    }
}

} // namespace sfx


} // namespace


namespace {
rbt<int> tr[2][maxn];

constexpr int inf = 1e9;
void Insert(rbt<int> &t, int val) {
    t.insert(val);
}
int Query(rbt<int> &t, int val) { // # <= val
    return t.order_of_key(val + 1);
}

int pa[maxn];
int sz[maxn];

int64_t ans = 0;
int anc(int x) {
    return x==pa[x] ? x : pa[x]=anc(pa[x]);
}

void Merge(int a, int b, int h) {
    a = anc(a);
    b = anc(b);
    assert (a != b);

    // for (auto [i, _s1]: tr[1][b]) {
    //     for (auto [j, _s2]: tr[0][a]) {
    //         if (i + j < 0 && i + j - 1 + h+1 <= 0) {
    //             cerr << "i, j " << i << ',' << j << ' ' << h << endl;
    //             ++ans;
    //         }
    //     }
    // }

    if (sz[a] < sz[b]) {
        swap(a, b);
    }

    if (a < b) {
        for (int i: tr[1][b]) {
            int tv = min(-i-1, -i - h);
            ans += Query(tr[0][a], tv);
        }
    } else {
        for (int j: tr[0][b]) {
            int tv = min(-j - 1, -j - h);
            ans += Query(tr[1][a], tv);
        }
    }

    for (int val: tr[0][b]) {
        tr[0][a].insert(val);
    }
    for (int val: tr[1][b]) {
        tr[1][a].insert(val);
    }
    tr[0][b].clear();
    tr[1][b].clear();

    pa[b] = a;
    sz[a] += sz[b];
}

}


int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    string s; cin >> s;

    string T = s;
    reverse(T.begin(), T.end());
    T += '$';
    T += s;
    sfx::build(T);

    int n = s.size();
    for (int i = 0; i < n; i++) {
        Insert( tr[0][sfx::rev[n - i - 1]], -(i + 1) );
        // cerr << T.substr(n - i - 1) << endl;
    }
    // cerr << "---\n";
    for (int i = 0; i < n; i++) {
        Insert( tr[1][sfx::rev[i + n + 1]], (i + 1) );
        // cerr << T.substr(i + n + 1) << endl;
    }
    // cerr << "===\n";

    vector<int> ord(T.size() - 1);
    iota(ord.begin(), ord.end(), 1);
    sort(ord.begin(), ord.end(), [](int x, int y) {
        return sfx::hi[x] > sfx::hi[y];
    });

    iota(pa, pa + T.size(), 0);
    fill(sz, sz + T.size(), 1);


    for (int pos: ord) {
        Merge(pos - 1, pos, sfx::hi[pos]);
    }

    cout << ans << '\n';

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 44ms
memory: 79928kb

input:

jjikkollp

output:

4

result:

ok 1 number(s): "4"

Test #2:

score: 0
Accepted
time: 24ms
memory: 83976kb

input:

pbpbppb

output:

7

result:

ok 1 number(s): "7"

Test #3:

score: 0
Accepted
time: 1108ms
memory: 112612kb

input:

tttbdckvkpisriwezmudlrwfkzxjtwrkhxmpqtfunhombmpqygpibgjvnyrjzvnkvwcsgtcdifujfqanmrvwkuxhgtntanazgeaermjdlrcbppwxsrdykkyxalfxsgjyktafbyrnlekwwbfsxbnwjfkkmwtcnytkbqqlfxxxfiomtsvyefkiojehqmvezcprdsxafpxjuvxcbwyjuugzcoszeuqzupgzwrykubltkeyiqdegtrtjxrjadqbngrktaflcatkuhofycrtxpaacfmtwmtheagxwynmibnrpwoej...

output:

9987275747

result:

ok 1 number(s): "9987275747"

Test #4:

score: 0
Accepted
time: 32ms
memory: 83936kb

input:

a

output:

0

result:

ok 1 number(s): "0"

Test #5:

score: 0
Accepted
time: 226ms
memory: 108608kb

input:

dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...

output:

0

result:

ok 1 number(s): "0"

Test #6:

score: 0
Accepted
time: 851ms
memory: 108860kb

input:

cccccccccccccccccccccccccccccccccccccccccccccccccxcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccocccccccccccccccccccccccccccccccccccccccccccccxcccccccccccjcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc...

output:

10020572944

result:

ok 1 number(s): "10020572944"

Test #7:

score: 0
Accepted
time: 903ms
memory: 108908kb

input:

ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttjttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttetttttttttttttttttt...

output:

10270918647

result:

ok 1 number(s): "10270918647"

Test #8:

score: 0
Accepted
time: 354ms
memory: 95396kb

input:

ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooocoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

2531342670

result:

ok 1 number(s): "2531342670"

Test #9:

score: 0
Accepted
time: 513ms
memory: 117444kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

0

result:

ok 1 number(s): "0"

Test #10:

score: 0
Accepted
time: 540ms
memory: 115984kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

0

result:

ok 1 number(s): "0"

Test #11:

score: 0
Accepted
time: 258ms
memory: 99428kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

0

result:

ok 1 number(s): "0"

Test #12:

score: 0
Accepted
time: 525ms
memory: 114488kb

input:

zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

output:

19230655235

result:

ok 1 number(s): "19230655235"

Test #13:

score: 0
Accepted
time: 558ms
memory: 113192kb

input:

zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

output:

19230527746

result:

ok 1 number(s): "19230527746"

Test #14:

score: 0
Accepted
time: 232ms
memory: 96568kb

input:

zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

output:

4807659003

result:

ok 1 number(s): "4807659003"

Test #15:

score: 0
Accepted
time: 1124ms
memory: 116752kb

input:

aaaaaaaaaaeataagaaaaaaaaaaualapaaaaagaaaaaafamaaaaaaaalaaaaaaaaaaaaaiaapagaaaxaaaaaaaaaaiaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaafaaaayavayaaaiaiaaaoaaaaaaaeaaaaaauaaaaaaaaaaaauahayaaaaaaaaaaaaxaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaauaaaaaaaanaaanaaahaaaaaaaaaaaaaaaaaajaaanaaaaaaaaqaraaaaaaaaaaaaaaaaaaca...

output:

2289060770

result:

ok 1 number(s): "2289060770"

Test #16:

score: 0
Accepted
time: 962ms
memory: 113984kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaahaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

447195772

result:

ok 1 number(s): "447195772"

Test #17:

score: 0
Accepted
time: 369ms
memory: 97576kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaqaaaaaaaaaaaaaaaaaaaaaaaraaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

145781946

result:

ok 1 number(s): "145781946"

Test #18:

score: 0
Accepted
time: 1060ms
memory: 117656kb

input:

zzzzzzzzzzzzuztzzzzzzzzzzwzzczzzzzczzzzzzzzzzzzwzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzgzzzzzizzzzzzlzzzzzzzzzzzzzzzzwzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzazzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzkzzzzizzzzzzzzzzzzzzzzzzmzzzzzzzzzzzzzzzzzzzzzzzzzzzezzzzzvzzzzzizzzzzzzzzzzzzzmzzzzfzrzzzzzbuzzzzzzzzzz...

output:

18409032362

result:

ok 1 number(s): "18409032362"

Test #19:

score: 0
Accepted
time: 1015ms
memory: 112368kb

input:

zzzzgzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzwzzzzzgzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzdzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzezzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

output:

19438576443

result:

ok 1 number(s): "19438576443"

Test #20:

score: 0
Accepted
time: 495ms
memory: 97900kb

input:

zzzszzzznzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzmzzznzzzjzzzzpzwzzzzzzzzzzzzzzzzzzzzzzwzzzzzzzzzzzezzzzkzzzzzbzzzzzzzzzzzzzzzzzzzzzzzzzzzzzczzzzzzzzzzzfmzzczzzzsmzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzjzzzzzzzzzzzzzzwzzzzzzzzzzuzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzvzzzzelz...

output:

4680731829

result:

ok 1 number(s): "4680731829"

Test #21:

score: 0
Accepted
time: 782ms
memory: 111044kb

input:

pacsknzvgzskpqcxdaivkhhkviadxcqpkszgvznkscappacsknzvgzskpqcxdaivkhhkviadxcqpkszgvznkscappacsknzvgzskpqcxdaivkhhkviadxcqpkszgvznkscappacsknzvgzskpqcxdaivkhhkviadxcqpkszgvznkscappacsknzvgzskpqcxdaivkhhkviadxcqpkszgvznkscappacsknzvgzskpqcxdaivkhhkviadxcqpkszgvznkscappacsknzvgzskpqcxdaivkhhkviadxcqpkszg...

output:

9973238297

result:

ok 1 number(s): "9973238297"

Test #22:

score: 0
Accepted
time: 771ms
memory: 109556kb

input:

oaeszxkfsyqlxiavjaehbvsyvfzunkknuzfvysvbheajvaixlqysfkxzseaooaeszxkfsyqlxiavjaehbvsyvfzunkknuzfvysvbheajvaixlqysfkxzseaooaeszxkfsyqlxiavjaehbvsyvfzunkknuzfvysvbheajvaixlqysfkxzseaooaeszxkfsyqlxiavjaehbvsyvfzunkknuzfvysvbheajvaixlqysfkxzseaooaeszxkfsyqlxiavjaehbvsyvfzunkknuzfvysvbheajvaixlqysfkxzseao...

output:

9973273540

result:

ok 1 number(s): "9973273540"

Test #23:

score: 0
Accepted
time: 310ms
memory: 98304kb

input:

zzqwejqiyypyawscjcbalvyjanyekkeynajyvlabcjcswaypyyiqjewqzzzzqwejqiyypyawscjcbalvyjanyekkeynajyvlabcjcswaypyyiqjewqzzzzqwejqiyypyawscjcbalvyjanyekkeynajyvlabcjcswaypyyiqjewqzzzzqwejqiyypyawscjcbalvyjanyekkeynajyvlabcjcswaypyyiqjewqzzzzqwejqiyypyawscjcbalvyjanyekkeynajyvlabcjcswaypyyiqjewqzzzzqwejqiyy...

output:

2486021051

result:

ok 1 number(s): "2486021051"

Test #24:

score: 0
Accepted
time: 559ms
memory: 118140kb

input:

cnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnc...

output:

9439930932

result:

ok 1 number(s): "9439930932"

Test #25:

score: 0
Accepted
time: 658ms
memory: 114568kb

input:

oyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryo...

output:

9704207014

result:

ok 1 number(s): "9704207014"

Test #26:

score: 0
Accepted
time: 312ms
memory: 100408kb

input:

tuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihut...

output:

2431144645

result:

ok 1 number(s): "2431144645"

Test #27:

score: 0
Accepted
time: 60ms
memory: 85316kb

input:

ultejuinafygvtkglxcpwbwqonryoocxlvyraiisvmonhhkqwrnhtkwfwwoglvywbslptaspzyaaecemiprcithpmlobcxnajbhpmofqkelnknjtoqklrocwlkgtkzlvvpqrqjbxhevdhcdcadwmtkmimzpcbhynttydoyxjdlehnfsnuegnzwchipqbtgfutlasedxgpyprxbkghrkfnqwohhicjgrqyuvqsylxethjevtiofztjfhpmvjgmlixpvmprkizxglesjlohjzrarusfutrzbokqowzfdrxxwnu...

output:

25310346

result:

ok 1 number(s): "25310346"

Test #28:

score: 0
Accepted
time: 37ms
memory: 83216kb

input:

iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii...

output:

0

result:

ok 1 number(s): "0"

Test #29:

score: 0
Accepted
time: 52ms
memory: 81156kb

input:

nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnndnnnnnnnnnnnannnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnndnnnnnnnnnnnnn...

output:

25496433

result:

ok 1 number(s): "25496433"

Test #30:

score: 0
Accepted
time: 51ms
memory: 81412kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

0

result:

ok 1 number(s): "0"

Test #31:

score: 0
Accepted
time: 48ms
memory: 85448kb

input:

zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

output:

48074404

result:

ok 1 number(s): "48074404"

Test #32:

score: 0
Accepted
time: 54ms
memory: 85592kb

input:

aaaaaaaaaaaaagaaaaaaaaaaaaaaaaaaaeaagkaaakaqaaaaaaaaaaaaaaaaaaaaeaaaaaaaajaaaeaaaaaaaapaaaoaaaaalaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaauaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaiaaaaaaaaaasaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadaaaaaaaawaaaaaaaaaaaaaaaaaaaaaaaaaaaaahaaaaaaaaaaauaaaaaaaaaaaaaaacaaaaaaauaa...

output:

2831203

result:

ok 1 number(s): "2831203"

Test #33:

score: 0
Accepted
time: 58ms
memory: 83380kb

input:

zzzzzzzzzzzzzzzyzzzzzzzzzzzzzzzzzzzzjzzzzzzzzzzzzzzzzzzzzzzzzzbzzzzzzuzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzfzzzzzzzzzzzzzzzzuzzzzzzzzzzzzzzzzzzzzzazzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzqzzzzzzzzzzzzzizzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzvzzz...

output:

47656154

result:

ok 1 number(s): "47656154"

Test #34:

score: 0
Accepted
time: 64ms
memory: 85484kb

input:

dqeybhneaaggaaejsbukuihukkuhxxxxhukkuhiukubsjeaaggaaenhbyeqddqeybhneaaggaaejsbukuihukkuhxxxxhukkuhiukubsjeaaggaaenhbyeqddqeybhneaaggaaejsbukuihukkuhxxxxhukkuhiukubsjeaaggaaenhbyeqddqeybhneaaggaaejsbukuihukkuhxxxxhukkuhiukubsjeaaggaaenhbyeqddqeybhneaaggaaejsbukuihukkuhxxxxhukkuhiukubsjeaaggaaenhbyeqd...

output:

24694861

result:

ok 1 number(s): "24694861"

Test #35:

score: 0
Accepted
time: 43ms
memory: 85432kb

input:

xbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbx...

output:

24694646

result:

ok 1 number(s): "24694646"