QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#97609#275. Palindromesyukino_yukinoshita100 ✓56ms62200kbC++141.4kb2023-04-17 14:10:442023-04-17 14:10:46

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-17 14:10:46]
  • 评测
  • 测评结果:100
  • 用时:56ms
  • 内存:62200kb
  • [2023-04-17 14:10:44]
  • 提交

answer

#include <bits/stdc++.h>
#define FOR(i,j,k) for(int i=j; i<=k; ++i)
#define ROF(i,j,k) for(int i=j; i>=k; --i)
inline int read (void) {
  int x = 0, f = 1, ch = getchar();
  while(!isdigit(ch)) { if(ch == '-') f = -f; ch = getchar(); }
  while(isdigit(ch)) { x = x * 10 + ch - '0'; ch = getchar(); }
  return x * f;
}
using ll = long long;
const int maxn = 300005;
char c[maxn];
int tot, lst, trans[maxn][26], len[maxn], fail[maxn], cnt[maxn];
inline int newnode (int l) {
  len[++ tot] = l; return tot;
}
inline void prework (void) {
  tot = -1; fail[0] = 1;
  newnode (0); newnode (-1);
}
inline int getfail (int x, int pos) {
  while(c[pos] != c[pos - len[x] - 1]) x = fail[x];
  return x;
}
inline void insert (int pos) {
  int x = getfail (lst, pos);
  if(!trans[x][c[pos] - 'a']) {
    int y = newnode (len[x] + 2);
    fail[y] = trans[getfail (fail[x], pos)][c[pos] - 'a'];
    trans[x][c[pos] - 'a'] = y;
  } lst = trans[x][c[pos] - 'a'];
}
std::vector <int> v[maxn];
ll ans;
void dfs (int x) {
  for(auto&it:v[x]) {
    dfs (it);
    cnt[x] += cnt[it];
  }
  if(len[x] > 0) ans = std::max(ans, 1ll * len[x] * cnt[x]);
}
int main (void) {
  scanf("%s", c+1);
  int n = strlen(c+1);
  prework ();
  FOR(i,1,n) {
    insert (i);
    ++ cnt[lst];
  }
  FOR(i,2,tot) v[fail[i]].push_back(i);
  dfs (0); dfs (1);
  printf("%lld\n", ans);
  return 0;
}

詳細信息

Subtask #1:

score: 8
Accepted

Test #1:

score: 8
Accepted
time: 2ms
memory: 16088kb

input:

abacaba

output:

7

result:

ok single line: '7'

Test #2:

score: 0
Accepted
time: 2ms
memory: 13532kb

input:

www

output:

4

result:

ok single line: '4'

Test #3:

score: 0
Accepted
time: 1ms
memory: 14740kb

input:

abacababa

output:

9

result:

ok single line: '9'

Test #4:

score: 0
Accepted
time: 1ms
memory: 13472kb

input:

r

output:

1

result:

ok single line: '1'

Test #5:

score: 0
Accepted
time: 0ms
memory: 13720kb

input:

xd

output:

1

result:

ok single line: '1'

Test #6:

score: 0
Accepted
time: 2ms
memory: 13240kb

input:

dd

output:

2

result:

ok single line: '2'

Test #7:

score: 0
Accepted
time: 0ms
memory: 14944kb

input:

opo

output:

3

result:

ok single line: '3'

Test #8:

score: 0
Accepted
time: 3ms
memory: 12968kb

input:

opoo

output:

3

result:

ok single line: '3'

Test #9:

score: 0
Accepted
time: 0ms
memory: 14740kb

input:

abacabadabacaba

output:

15

result:

ok single line: '15'

Test #10:

score: 0
Accepted
time: 1ms
memory: 12988kb

input:

xxxxxyxxxxyxxxxx

output:

24

result:

ok single line: '24'

Test #11:

score: 0
Accepted
time: 1ms
memory: 14396kb

input:

xxxyxxxyzzzabcdxxdcba

output:

10

result:

ok single line: '10'

Test #12:

score: 0
Accepted
time: 4ms
memory: 14360kb

input:

qpppppppwowpppppq

output:

24

result:

ok single line: '24'

Test #13:

score: 0
Accepted
time: 1ms
memory: 13532kb

input:

mqmwmemrmtymmmmmmmmqwertyeeeeeeeee

output:

25

result:

ok single line: '25'

Test #14:

score: 0
Accepted
time: 3ms
memory: 16168kb

input:

mqmwmmmmmemrmtymmmmmmmmqwertyeeeeeeeee

output:

28

result:

ok single line: '28'

Test #15:

score: 0
Accepted
time: 4ms
memory: 13724kb

input:

abcdefghijklmnopqrstuvwxyzz

output:

2

result:

ok single line: '2'

Test #16:

score: 0
Accepted
time: 0ms
memory: 16108kb

input:

abcdefghijklmnopqrstuvwxyz

output:

1

result:

ok single line: '1'

Test #17:

score: 0
Accepted
time: 5ms
memory: 13312kb

input:

apiodpdpdpdpdpgoodchallenge

output:

15

result:

ok single line: '15'

Test #18:

score: 0
Accepted
time: 1ms
memory: 13232kb

input:

pdpdpdpxdpdpdxdpdpdx

output:

18

result:

ok single line: '18'

Test #19:

score: 0
Accepted
time: 1ms
memory: 13412kb

input:

jejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejeje

output:

1176

result:

ok single line: '1176'

Test #20:

score: 0
Accepted
time: 1ms
memory: 13204kb

input:

wzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzw

output:

1225

result:

ok single line: '1225'

Test #21:

score: 0
Accepted
time: 1ms
memory: 13208kb

input:

qsqsqsqsqsqsqianananananananananaygsgsgsgsgsgsgsgsgsgsgsgsgsgsgsgszikidnsnsnsnsnsnsnsnsnsnsnsnsn

output:

136

result:

ok single line: '136'

Test #22:

score: 0
Accepted
time: 1ms
memory: 14484kb

input:

hsoqhdnglglqqhqhqhqhqhqhqmyiyiyiyiyiyiyiyiywrvrvrvrvrvzttttfsfsfsfgkhkhkhkfuhuhlggggggggssfsfs

output:

45

result:

ok single line: '45'

Test #23:

score: 0
Accepted
time: 1ms
memory: 13728kb

input:

ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

output:

2500

result:

ok single line: '2500'

Test #24:

score: 0
Accepted
time: 0ms
memory: 13852kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcpppppppppppppppppppppnuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu

output:

380

result:

ok single line: '380'

Test #25:

score: 0
Accepted
time: 6ms
memory: 13332kb

input:

jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj

output:

2304

result:

ok single line: '2304'

Test #26:

score: 0
Accepted
time: 2ms
memory: 14524kb

input:

gggggggggtoooooooooccwwwwwwwwwwwwwwwwmllllllllllllllxvvjeeeppppppdnswwwwieeeeeeeeeeeeeeeeeeeesl

output:

110

result:

ok single line: '110'

Test #27:

score: 0
Accepted
time: 4ms
memory: 15176kb

input:

vlvivlvwvlvivlvkvlvivlvwvlvivlvfvlvivlvwvlvivlvkvlvivlvwvlvivlvzvlvivlvwvlvivlvkvlvivlvwvlvivlvfvlvi

output:

93

result:

ok single line: '93'

Test #28:

score: 0
Accepted
time: 5ms
memory: 14596kb

input:

nbnenbnjnbnenbnxnbnenbnjnbnenbnmnbnenbnjnbnenuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu

output:

729

result:

ok single line: '729'

Test #29:

score: 0
Accepted
time: 3ms
memory: 16212kb

input:

ydycydylydycydyodoycydylydycydybydyccccccccccccccccccccccdycydyxydycydylydycydyrydycydylydycydybydvq

output:

132

result:

ok single line: '132'

Test #30:

score: 0
Accepted
time: 1ms
memory: 14400kb

input:

dzydpxreexldgbslbouxllaizermiyzzmnawejbabckjdqybqwsaysietcsdfkclenvpkbsxhumglxvxmprkijakygjgjsbsawfj

output:

7

result:

ok single line: '7'

Test #31:

score: 0
Accepted
time: 4ms
memory: 14452kb

input:

bpmerpingvjipwmenzzalhrsmrkmxvmizieduxoxlxembhjjfrxsrecuhmntpwbjhxysmgrqvuqxhysalvpeurrkdifqloo

output:

8

result:

ok single line: '8'

Test #32:

score: 0
Accepted
time: 3ms
memory: 13844kb

input:

abbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaab

output:

64

result:

ok single line: '64'

Subtask #2:

score: 15
Accepted

Dependency #1:

100%
Accepted

Test #33:

score: 15
Accepted
time: 1ms
memory: 13856kb

input:

yhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyhyh...

output:

124251

result:

ok single line: '124251'

Test #34:

score: 0
Accepted
time: 4ms
memory: 14672kb

input:

nknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknknk...

output:

38226

result:

ok single line: '38226'

Test #35:

score: 0
Accepted
time: 6ms
memory: 13852kb

input:

oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

249500

result:

ok single line: '249500'

Test #36:

score: 0
Accepted
time: 1ms
memory: 16052kb

input:

ktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktktkokpkpkpkpkpkpjrjrjrjrjrjrjrjrjrjrjrjrjrjrjrjrjrjhtktpwuwuwuwuwuwuwuwuwuwuwuwiisisisisis...

output:

5778

result:

ok single line: '5778'

Test #37:

score: 0
Accepted
time: 5ms
memory: 13812kb

input:

gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg...

output:

247506

result:

ok single line: '247506'

Test #38:

score: 0
Accepted
time: 1ms
memory: 14680kb

input:

dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...

output:

248004

result:

ok single line: '248004'

Test #39:

score: 0
Accepted
time: 1ms
memory: 14668kb

input:

tdtytdtxtdtytdtptdtytdtxtdtytdtmtdtytdtxtdtytdtptdtytdtxtdtytdtbtdtytdtxtdtytdtptdtytdtxtdtytdtmtdtytdtxtdtytdtptdtytdtxtdtytdtztdtytdtxtdtytdtptdtytdtxtdtytdtmtdtytdtxtdtytdtptdtytdtxtdtytdtbtdtytdtxtdtytdtptdtytdtxtdtytdtmtdtytdtxtdtytdtptdtytdtxtdtytdtetdtytdtxtdtytdtptdtytdtxtdtytdtmtdtytdtxtdty...

output:

973

result:

ok single line: '973'

Test #40:

score: 0
Accepted
time: 5ms
memory: 14048kb

input:

xfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxfxf...

output:

123753

result:

ok single line: '123753'

Test #41:

score: 0
Accepted
time: 5ms
memory: 13812kb

input:

yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyybbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbgvgtgsgtgvgtgegtgvgtgygtgvgtgegtgvgtgngtgvgtgegtgvgtgygtgvgtgegtgvgtgbgtgvgtgegtgvgtgygtgvgtgegtgvgtgngtgvgtgegtgvgtgygtgvgtgegtgvgtgmgtgvgtgegtgvgtgygtgvgtgegtgvgtgngtgvgtgegtgv...

output:

2346

result:

ok single line: '2346'

Test #42:

score: 0
Accepted
time: 2ms
memory: 13660kb

input:

phxbzjihyzgshwcidlnkwkltarrnbvkgkzdakoyzeuhoeizcoemcdrtqrsesggbnvltdwrjahpekhylmtkwfcxrvgzdcarhtxkhejosurcntcgsycxkrkxspdqfcwiscudscsmfxjqxmxacgdzjupbaqbfzpsasyrvrpuhuusulurpmwfllpgbtgqnslvjupnpvgfvrdlowwsoaqsepmzdsirpmklgugblxexfxhtjigkhiwndihqsnowlrbyxeqczhyesczvuwthgvidmwtarmbokalyabzmdddcegplfpn...

output:

53

result:

ok single line: '53'

Test #43:

score: 0
Accepted
time: 0ms
memory: 14440kb

input:

nkevzhqlzcmqmbvtbojxbbtvgsxkbhyxrmwkzvvnvqppgbcgwplnupeizuimryoomumihznxizqcchutpzangopekbxirfgpunctyhdvkuhloshxnsmbyjtsdkevaaktccybajxmesubgmfennovcwlskuzjencrbafrzvgylsrzxpxvbrwapbkbqehtdopkgnvdifhkvtzbbjzdylautvnjqcmbrdyxpgsjtxptpayfyiyybkgvodovlvehskrvhtecinxbucymhucgudaujpcujdtgwdojjjvkewtjnghe...

output:

52

result:

ok single line: '52'

Test #44:

score: 0
Accepted
time: 3ms
memory: 14972kb

input:

abbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaababbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaab...

output:

976

result:

ok single line: '976'

Subtask #3:

score: 24
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #45:

score: 24
Accepted
time: 7ms
memory: 14412kb

input:

lnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnlnln...

output:

12497500

result:

ok single line: '12497500'

Test #46:

score: 0
Accepted
time: 4ms
memory: 17524kb

input:

qhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqhqh...

output:

6481800

result:

ok single line: '6481800'

Test #47:

score: 0
Accepted
time: 0ms
memory: 15716kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

25000000

result:

ok single line: '25000000'

Test #48:

score: 0
Accepted
time: 2ms
memory: 15680kb

input:

ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff...

output:

17816841

result:

ok single line: '17816841'

Test #49:

score: 0
Accepted
time: 1ms
memory: 14568kb

input:

xlxixlxpxlxixlxexlxixlxpxlxixlxgxlxixlxpxlxixlxexlxixlxpxlxixlxmxlxixlxpxlxixlxexlxixlxpxlxixlxgxlxixlxpxlxixlxexlxixlxpxlxixlxfxlxixlxpxlxixlxexlxixlxpxlxixlxgxlxixlxpxlxixlxexlxixlxpxlxixlxmxlxixlxpxlxixlxexlxixlxpxlxixlxgxlxixlxpxlxixlxexlxixlxpxlxixlxsxlxixlxpxlxixlxexlxixlxpxlxixlxgxlxixlxpxlxi...

output:

9945

result:

ok single line: '9945'

Test #50:

score: 0
Accepted
time: 2ms
memory: 14556kb

input:

elelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelelel...

output:

504100

result:

ok single line: '504100'

Test #51:

score: 0
Accepted
time: 2ms
memory: 17476kb

input:

afamafacafamafakafamafacafamafaqafaanananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananananana...

output:

1512930

result:

ok single line: '1512930'

Test #52:

score: 0
Accepted
time: 1ms
memory: 14796kb

input:

hmdqbxxvfzcxpohuffioztrgqgxkhfvtpgpudbbyaihadhzbeqrmjhljwmflxhhmrjqaumcacixjrcegaloxzzoprmnrzuldssiyuxfjtxsjjhvywupyviwunipmgxuqalcxatphosveipikcopziexcpspnidczvmupoxvabmlndxdrcrhdregvkqxnsjyfyvbqusygczosimhtjdbwwnlrqasixheataqyjwpxmrrkpxrvcbmkzbdafyahbzrhxkfbkfzrawufisbrdzfkdhuivwqueqlhisiwmahvagqn...

output:

413

result:

ok single line: '413'

Test #53:

score: 0
Accepted
time: 1ms
memory: 13128kb

input:

xznwghgyngrjehtffuiepaedcvdovapnjltjdavlxwmmcexbvxuhlohrfdjwnoimduzngahcupnwmuvqgyqutwaxzpxcqbvahcwwndugzesfkyhyxxehphrdhzucneyhdtlxhixdqrzmbtjxnatzjmwftvjknajzugquxubfmqvqxxqkpztyjfqsuzreyegwqvjbdqfzdjmctntsyjocdlxulnvqvxfjxdpefduawiosrekasgtqpnyhxuglvxorkqyemjkvcsimphvgwspqpaigfulymtkryxeibdilknxm...

output:

428

result:

ok single line: '428'

Test #54:

score: 0
Accepted
time: 4ms
memory: 14840kb

input:

abbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaababbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaab...

output:

7232

result:

ok single line: '7232'

Subtask #4:

score: 26
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #55:

score: 26
Accepted
time: 19ms
memory: 28024kb

input:

bhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbhbh...

output:

1249925001

result:

ok single line: '1249925001'

Test #56:

score: 0
Accepted
time: 12ms
memory: 28236kb

input:

usususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususususus...

output:

396337935

result:

ok single line: '396337935'

Test #57:

score: 0
Accepted
time: 13ms
memory: 29728kb

input:

yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy...

output:

2500050000

result:

ok single line: '2500050000'

Test #58:

score: 0
Accepted
time: 12ms
memory: 28912kb

input:

llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll...

output:

1016525689

result:

ok single line: '1016525689'

Test #59:

score: 0
Accepted
time: 7ms
memory: 25052kb

input:

kvkikvklkvkikvkgkvkikvklkvkikvkckvkikvklkvkikvkgkvkikvklkvkikvkakvkikvklkvkikvkgkvkikvklkvkikvkckvkikvklkvkikvkgkvkikvklkvkikvkxkvkikvklkvkikvkgkvkikvklkvkikvkckvkikvklkvkikvkgkvkikvklkvkikvkakvkikvklkvkikvkgkvkikvklkvkikvkckvkikvklkvkikvkgkvkikvklkvkikvkhkvkikvklkvkikvkgkvkikvklkvkikvkckvkikvklkvki...

output:

99645

result:

ok single line: '99645'

Test #60:

score: 0
Accepted
time: 11ms
memory: 22424kb

input:

pqpzpqpupqpzpqpbpqpzpqpupqpzpqpwpqpzpqpupqpzpqpbpqpzpqpupqpzpqpipqpzpqpupqpzpqpbpqpzpqpupqpzpqpwpqpzpqpupqpzpqpbpqpzpqpupqpzpqpspqpzpqpupqpzpqpbpqpzpqpupqpzpqpwpqpzpqpupqpzpqpbpqpzpqpupqpzpqpipqpzpqpupqpzpqpbpqpzpqpupqpzpqpwpqpzpqpupqpzpqpbpqpzpqpupqpzpqpgpqpzpqpupqpzpqpbpqpzpqpupqpzpqpwpqpzpqpupqpz...

output:

78569380

result:

ok single line: '78569380'

Test #61:

score: 0
Accepted
time: 9ms
memory: 27204kb

input:

qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq...

output:

82810000

result:

ok single line: '82810000'

Test #62:

score: 0
Accepted
time: 2ms
memory: 14880kb

input:

vmlqjhjiwwzijupbzztlkcxbcdavxyqryzttbvvwwekgresldvhrtwwzkgldqvmtecanlhirufqzzvfoybnqorcgmpzhkedhxelbfgkdrktqblcsfngtmhpijdbmtznvmatyrwrbjkmmtgbbwhsiacswcuvszlwgveqehiudnnnuetqucajijlzcomkqfvhaukpnzwlrysonewxfopijuyatwmpslwelwljnkyiibdeuvernjqizvzmtutgsvzdjfksyghkmbqimxarcmkerlbrxnfehzpbmzrvzbjhetlgv...

output:

3989

result:

ok single line: '3989'

Test #63:

score: 0
Accepted
time: 3ms
memory: 17880kb

input:

bcqqtvvdvexrttkgcbhmlhoasnlcektbxssxkxyavuqritimuzvnaurotozfdfglteetpbnpuvymvaghqzqznontyyxciqbglyaedgnzxjzmvampibduzoypreeconehptujqukxezbdcmcguzxgeqzsuqrrhtiudmeqflamybdebwpdkgohesfmbzemzojexzcljvcopvtvlovbngdvhxcshgbwcaluonvfzlaloirqpqqpnbhbbhvyizecupuoyhmcfbobawpqlwmtornvtipqsfphujgltwmodxdcwfpg...

output:

125529616

result:

ok single line: '125529616'

Test #64:

score: 0
Accepted
time: 7ms
memory: 23220kb

input:

abbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaababbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaab...

output:

66664

result:

ok single line: '66664'

Subtask #5:

score: 27
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #65:

score: 27
Accepted
time: 30ms
memory: 58160kb

input:

bnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbn...

output:

11250075000

result:

ok single line: '11250075000'

Test #66:

score: 0
Accepted
time: 31ms
memory: 55516kb

input:

jzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjzjz...

output:

894243195

result:

ok single line: '894243195'

Test #67:

score: 0
Accepted
time: 27ms
memory: 62200kb

input:

yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy...

output:

22499400004

result:

ok single line: '22499400004'

Test #68:

score: 0
Accepted
time: 44ms
memory: 57104kb

input:

zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

output:

2958163321

result:

ok single line: '2958163321'

Test #69:

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

input:

xqxtxqxwxqxtxqxlxqxtxqxwxqxtxqxexqxtxqxwxqxtxqxlxqxtxqxwxqxtxqxyxqxtxqxwxqxtxqxlxqxtxqxwxqxtxqxexqxtxqxwxqxtxqxlxqxtxqxwxqxtxqxsxqxtxqxwxqxtxqxlxqxtxqxwxqxtxqxexqxtxqxwxqxtxqxlxqxtxqxwxqxtxqxyxqxtxqxwxqxtxqxlxqxtxqxwxqxtxqxexqxtxqxwxqxtxqxlxqxtxqxwxqxtxqxvxqxtxqxwxqxtxqxlxqxtxqxwxqxtxqxexqxtxqxwxqxt...

output:

298935

result:

ok single line: '298935'

Test #70:

score: 0
Accepted
time: 21ms
memory: 51908kb

input:

zwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzwzw...

output:

1210831209

result:

ok single line: '1210831209'

Test #71:

score: 0
Accepted
time: 27ms
memory: 47564kb

input:

hyhnhyhehyhnhyhlhyhnhyhehyhnhyhkhyhnhyhehyhnhyhlhyhnhyhehyhnhyhdhyhnhyhehyhnhyhlhyhnhyhehyhnhyhkhyhnhyhehyhnhyhlhyhnhyhehyhnhyhwhyhnhyhehyhnhyhlhyhnhyhehyhnhyhkhyhnhyhehyhnhyhlhyhnhyhehyhnhyhdhyhnhyhehyhnhyhlhyhnhyhehyhnhyhkhyhnhyhehyhnhyhlhyhnhyhehyhnhyhvhyhnhyhehyhnhyhlhyhnhyhehyhnhyhkhyhnhyhehyhn...

output:

303195156

result:

ok single line: '303195156'

Test #72:

score: 0
Accepted
time: 4ms
memory: 16376kb

input:

hnrootvymrwweaxjusfltkgyqyeioonpksxtampxsamlfcitaauwcjfmxbtvghsyswjyaephlciqgpdwvqnkdhtzkqmyuqukbsobqrpuowsyspglpdypcejwdvolfyezxpjyjztwgcgudvrtsdxouampqybzqtoosumwzwsgboqbgpdycknpatsirizrqioxoxdjfxwdvnqixhlstcrvrkpvazncakguavcbjazssqsfbnrdrhdlozsohomcpannklcxcluhcjvumhfntubbqwnmeosusnoopqicougnnpxc...

output:

11804

result:

ok single line: '11804'

Test #73:

score: 0
Accepted
time: 5ms
memory: 15208kb

input:

yoljcehfgzraqykusrdwgqxdudzvepmjvrsfoosapcxoxoqzfaebohkstrtgnawnonwuynojpzulyulmlxfzbdmqeofumicjihysfofcyfhnsjurggtonwstxatbpoffhamgqkktzdphibrpeiiledjizhvrcnywcyyhvujhqvhvsyxkifcizpczjawdwuxkrxcmkqbsrlbrorrcyznwzpcejgrryyxnursejnogvjlehfspyutfnbmjniaaxtsfmnsvsebwotxqempvqreeeslrxwlljwsawxkktdayuumi...

output:

11813

result:

ok single line: '11813'

Test #74:

score: 0
Accepted
time: 28ms
memory: 42748kb

input:

abbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaababbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaab...

output:

262144

result:

ok single line: '262144'

Test #75:

score: 0
Accepted
time: 56ms
memory: 55744kb

input:

acbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabcacbabc...

output:

3750025000

result:

ok single line: '3750025000'

Test #76:

score: 0
Accepted
time: 2ms
memory: 18520kb

input:

uptvtysodzujkjcvrzkzydggrhjjlicywbakjpulmdqnlhzqbyhbblhzemftazrldvrxmfuiejvuxvevvescgolivepuwbdyyiylvtqubxfrnmouoshonhbwojudfexgnafvjxrogotuomkwlyoafqsqrzmomodmkxuguysscbidukwlblzrsyqdjsoaqfplvhmqhhpgkvztkpiwowfmjtujkzpileosqqsskywfnvaqhprbhcyfvbzrtkkjmbvxzqgfdoelxzecvgnsxiuvmassxzmweiixxppvmmbxvgol...

output:

184796836

result:

ok single line: '184796836'