QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#53890 | #4844. Positive String | zhoukangyang# | AC ✓ | 1902ms | 790464kb | C++11 | 3.2kb | 2022-10-06 10:49:45 | 2022-10-06 10:49:48 |
Judging History
answer
#include<bits/stdc++.h>
#define L(i, j, k) for(int i = (j); i <= (k); ++i)
#define R(i, j, k) for(int i = (j); i >= (k); --i)
#define ll long long
#define sz(a) ((int) (a).size())
#define vi vector < int >
#define me(a, x) memset(a, x, sizeof(a))
#define ull unsigned long long
#define ld __float128
using namespace std;
const int N = 8e5 + 7;
int n;
char s[N];
int ch[N][26], len[N], fa[N], tot = 1, lst = 1;
void cpy(int x, int y) {
len[y] = len[x], fa[y] = fa[x];
L(i, 0, 25) ch[y][i] = ch[x][i];
}
void ins(int x) {
int p = lst, now = lst = ++tot;
len[now] = len[p] + 1;
for(; p && !ch[p][x]; p = fa[p]) ch[p][x] = now;
if(!p) fa[now] = 1;
else {
int pto = ch[p][x];
if(len[pto] == len[p] + 1) fa[now] = pto;
else {
int sp = ++tot;
cpy(pto, sp), len[sp] = len[p] + 1;
fa[now] = fa[pto] = sp;
for(; p && ch[p][x] == pto; p = fa[p]) ch[p][x] = sp;
}
}
}
vector < pair < int, int > > prs[N];
vi e[N];
void merge(int x, int y) {
if(sz(prs[x]) < sz(prs[y]))
swap(prs[x], prs[y]);
}
int lw[N];
int f[N], ftot;
struct lct {
int fa[N], ch[N][2], siz[N], tag[N];
ll s[N], sum[N];
bool get(int x) {
return ch[fa[x]][0] == x || ch[fa[x]][1] == x;
}
void upd(int x) {
siz[x] = siz[ch[x][0]] + siz[ch[x][1]] + lw[x];
sum[x] = s[x] + sum[ch[x][0]] + sum[ch[x][1]];
}
void AD(int x, int y) {
if(x) tag[x] += y, s[x] += (ll) y * lw[x], sum[x] += (ll) y * siz[x];
}
void pushdown(int x) {
if(tag[x]) AD(ch[x][0], tag[x]), AD(ch[x][1], tag[x]), tag[x] = 0;
}
void rotate(int x) {
int y = fa[x], z = fa[y], fson = (ch[y][1] == x), ano = ch[x][fson ^ 1];
if(get(y)) ch[z][ch[z][1] == y] = x;
if(ano) fa[ano] = y;
fa[x] = z, fa[y] = x, ch[x][fson ^ 1] = y, ch[y][fson] = ano;
upd(y), upd(x);
}
void splay(int x) {
int fx = x; f[++ftot] = x;
while(get(fx)) fx = f[++ftot] = fa[fx];
while(ftot) pushdown(f[ftot--]);
while(get(x)) {
int y = fa[x], z = fa[y];
if(get(y)) rotate((ch[y][1] == x) ^ (ch[z][1] == y) ? x : y);
rotate(x);
}
}
void access(int x) {
for(int y = 0; x; y = x, x = fa[x]) splay(x), ch[x][1] = y, upd(x);
}
void insert(int x) {
access(x), splay(x), AD(x, 1);
}
ll query(int x) {
access(x), splay(x);
return sum[x];
}
} lct[27];
int cnt[N];
void insert(int x, int y) {
++x;
for(; x <= 26; x += x & -x) lct[x].insert(y);
}
ll query(int x, int y) {
ll ret = 0;
for(; x; x -= x & -x) ret += lct[x].query(y);
return ret;
}
int pl[N], pr[N];
ll ns;
int main() {
ios :: sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin >> (s + 1), n = strlen(s + 1);
lst = 1;
L(i, 1, n) ins(s[i] - 'a');
lst = 1;
R(i, n, 1) ins(s[i] - 'a');
pl[0] = pr[n + 1] = 1;
L(i, 1, n) pl[i] = ch[pl[i - 1]][s[i] - 'a'];
R(i, n, 1) pr[i] = ch[pr[i + 1]][s[i] - 'a'];
L(i, 2, n) prs[pl[i - 1]].push_back({s[i] - 'a', i});
L(i, 1, n - 1) prs[pr[i + 1]].push_back({s[i] - 'a', i});
L(i, 1, tot) lw[i] = len[i] - len[fa[i]];
lw[1] = 1;
L(i, 1, 26) L(j, 1, tot) lct[i].fa[j] = fa[j];
R(i, n, 1) {
ns += query(s[i] - 'a', pl[i - 1]);
insert(s[i] - 'a', pr[i + 1]);
}
cout << ns << '\n';
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 4ms
memory: 41548kb
input:
jjikkollp
output:
4
result:
ok 1 number(s): "4"
Test #2:
score: 0
Accepted
time: 4ms
memory: 41252kb
input:
pbpbppb
output:
7
result:
ok 1 number(s): "7"
Test #3:
score: 0
Accepted
time: 1111ms
memory: 590188kb
input:
tttbdckvkpisriwezmudlrwfkzxjtwrkhxmpqtfunhombmpqygpibgjvnyrjzvnkvwcsgtcdifujfqanmrvwkuxhgtntanazgeaermjdlrcbppwxsrdykkyxalfxsgjyktafbyrnlekwwbfsxbnwjfkkmwtcnytkbqqlfxxxfiomtsvyefkiojehqmvezcprdsxafpxjuvxcbwyjuugzcoszeuqzupgzwrykubltkeyiqdegtrtjxrjadqbngrktaflcatkuhofycrtxpaacfmtwmtheagxwynmibnrpwoej...
output:
9987275747
result:
ok 1 number(s): "9987275747"
Test #4:
score: 0
Accepted
time: 7ms
memory: 41340kb
input:
a
output:
0
result:
ok 1 number(s): "0"
Test #5:
score: 0
Accepted
time: 110ms
memory: 162552kb
input:
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...
output:
0
result:
ok 1 number(s): "0"
Test #6:
score: 0
Accepted
time: 1071ms
memory: 640432kb
input:
cccccccccccccccccccccccccccccccccccccccccccccccccxcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccocccccccccccccccccccccccccccccccccccccccccccccxcccccccccccjcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc...
output:
10020572944
result:
ok 1 number(s): "10020572944"
Test #7:
score: 0
Accepted
time: 963ms
memory: 632560kb
input:
ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttjttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttetttttttttttttttttt...
output:
10270918647
result:
ok 1 number(s): "10270918647"
Test #8:
score: 0
Accepted
time: 433ms
memory: 335656kb
input:
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooocoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...
output:
2531342670
result:
ok 1 number(s): "2531342670"
Test #9:
score: 0
Accepted
time: 202ms
memory: 251372kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
0
result:
ok 1 number(s): "0"
Test #10:
score: 0
Accepted
time: 217ms
memory: 251440kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
0
result:
ok 1 number(s): "0"
Test #11:
score: 0
Accepted
time: 127ms
memory: 147280kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
0
result:
ok 1 number(s): "0"
Test #12:
score: 0
Accepted
time: 247ms
memory: 264232kb
input:
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...
output:
19230655235
result:
ok 1 number(s): "19230655235"
Test #13:
score: 0
Accepted
time: 193ms
memory: 264136kb
input:
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...
output:
19230527746
result:
ok 1 number(s): "19230527746"
Test #14:
score: 0
Accepted
time: 90ms
memory: 153732kb
input:
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...
output:
4807659003
result:
ok 1 number(s): "4807659003"
Test #15:
score: 0
Accepted
time: 778ms
memory: 637228kb
input:
aaaaaaaaaaeataagaaaaaaaaaaualapaaaaagaaaaaafamaaaaaaaalaaaaaaaaaaaaaiaapagaaaxaaaaaaaaaaiaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaafaaaayavayaaaiaiaaaoaaaaaaaeaaaaaauaaaaaaaaaaaauahayaaaaaaaaaaaaxaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaauaaaaaaaanaaanaaahaaaaaaaaaaaaaaaaaajaaanaaaaaaaaqaraaaaaaaaaaaaaaaaaaca...
output:
2289060770
result:
ok 1 number(s): "2289060770"
Test #16:
score: 0
Accepted
time: 313ms
memory: 408788kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaahaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
447195772
result:
ok 1 number(s): "447195772"
Test #17:
score: 0
Accepted
time: 206ms
memory: 289036kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaqaaaaaaaaaaaaaaaaaaaaaaaraaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
145781946
result:
ok 1 number(s): "145781946"
Test #18:
score: 0
Accepted
time: 663ms
memory: 678024kb
input:
zzzzzzzzzzzzuztzzzzzzzzzzwzzczzzzzczzzzzzzzzzzzwzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzgzzzzzizzzzzzlzzzzzzzzzzzzzzzzwzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzazzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzkzzzzizzzzzzzzzzzzzzzzzzmzzzzzzzzzzzzzzzzzzzzzzzzzzzezzzzzvzzzzzizzzzzzzzzzzzzzmzzzzfzrzzzzzbuzzzzzzzzzz...
output:
18409032362
result:
ok 1 number(s): "18409032362"
Test #19:
score: 0
Accepted
time: 407ms
memory: 529572kb
input:
zzzzgzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzwzzzzzgzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzdzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzezzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...
output:
19438576443
result:
ok 1 number(s): "19438576443"
Test #20:
score: 0
Accepted
time: 318ms
memory: 377712kb
input:
zzzszzzznzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzmzzznzzzjzzzzpzwzzzzzzzzzzzzzzzzzzzzzzwzzzzzzzzzzzezzzzkzzzzzbzzzzzzzzzzzzzzzzzzzzzzzzzzzzzczzzzzzzzzzzfmzzczzzzsmzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzjzzzzzzzzzzzzzzwzzzzzzzzzzuzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzvzzzzelz...
output:
4680731829
result:
ok 1 number(s): "4680731829"
Test #21:
score: 0
Accepted
time: 1817ms
memory: 688940kb
input:
pacsknzvgzskpqcxdaivkhhkviadxcqpkszgvznkscappacsknzvgzskpqcxdaivkhhkviadxcqpkszgvznkscappacsknzvgzskpqcxdaivkhhkviadxcqpkszgvznkscappacsknzvgzskpqcxdaivkhhkviadxcqpkszgvznkscappacsknzvgzskpqcxdaivkhhkviadxcqpkszgvznkscappacsknzvgzskpqcxdaivkhhkviadxcqpkszgvznkscappacsknzvgzskpqcxdaivkhhkviadxcqpkszg...
output:
9973238297
result:
ok 1 number(s): "9973238297"
Test #22:
score: 0
Accepted
time: 1902ms
memory: 790464kb
input:
oaeszxkfsyqlxiavjaehbvsyvfzunkknuzfvysvbheajvaixlqysfkxzseaooaeszxkfsyqlxiavjaehbvsyvfzunkknuzfvysvbheajvaixlqysfkxzseaooaeszxkfsyqlxiavjaehbvsyvfzunkknuzfvysvbheajvaixlqysfkxzseaooaeszxkfsyqlxiavjaehbvsyvfzunkknuzfvysvbheajvaixlqysfkxzseaooaeszxkfsyqlxiavjaehbvsyvfzunkknuzfvysvbheajvaixlqysfkxzseao...
output:
9973273540
result:
ok 1 number(s): "9973273540"
Test #23:
score: 0
Accepted
time: 1008ms
memory: 412300kb
input:
zzqwejqiyypyawscjcbalvyjanyekkeynajyvlabcjcswaypyyiqjewqzzzzqwejqiyypyawscjcbalvyjanyekkeynajyvlabcjcswaypyyiqjewqzzzzqwejqiyypyawscjcbalvyjanyekkeynajyvlabcjcswaypyyiqjewqzzzzqwejqiyypyawscjcbalvyjanyekkeynajyvlabcjcswaypyyiqjewqzzzzqwejqiyypyawscjcbalvyjanyekkeynajyvlabcjcswaypyyiqjewqzzzzqwejqiyy...
output:
2486021051
result:
ok 1 number(s): "2486021051"
Test #24:
score: 0
Accepted
time: 645ms
memory: 312956kb
input:
cnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnc...
output:
9439930932
result:
ok 1 number(s): "9439930932"
Test #25:
score: 0
Accepted
time: 1223ms
memory: 497612kb
input:
oyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryo...
output:
9704207014
result:
ok 1 number(s): "9704207014"
Test #26:
score: 0
Accepted
time: 656ms
memory: 243644kb
input:
tuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihut...
output:
2431144645
result:
ok 1 number(s): "2431144645"
Test #27:
score: 0
Accepted
time: 52ms
memory: 69828kb
input:
ultejuinafygvtkglxcpwbwqonryoocxlvyraiisvmonhhkqwrnhtkwfwwoglvywbslptaspzyaaecemiprcithpmlobcxnajbhpmofqkelnknjtoqklrocwlkgtkzlvvpqrqjbxhevdhcdcadwmtkmimzpcbhynttydoyxjdlehnfsnuegnzwchipqbtgfutlasedxgpyprxbkghrkfnqwohhicjgrqyuvqsylxethjevtiofztjfhpmvjgmlixpvmprkizxglesjlohjzrarusfutrzbokqowzfdrxxwnu...
output:
25310346
result:
ok 1 number(s): "25310346"
Test #28:
score: 0
Accepted
time: 12ms
memory: 47640kb
input:
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii...
output:
0
result:
ok 1 number(s): "0"
Test #29:
score: 0
Accepted
time: 20ms
memory: 63272kb
input:
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnndnnnnnnnnnnnannnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnndnnnnnnnnnnnnn...
output:
25496433
result:
ok 1 number(s): "25496433"
Test #30:
score: 0
Accepted
time: 18ms
memory: 53292kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
0
result:
ok 1 number(s): "0"
Test #31:
score: 0
Accepted
time: 13ms
memory: 54216kb
input:
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...
output:
48074404
result:
ok 1 number(s): "48074404"
Test #32:
score: 0
Accepted
time: 24ms
memory: 70496kb
input:
aaaaaaaaaaaaagaaaaaaaaaaaaaaaaaaaeaagkaaakaqaaaaaaaaaaaaaaaaaaaaeaaaaaaaajaaaeaaaaaaaapaaaoaaaaalaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaauaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaiaaaaaaaaaasaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadaaaaaaaawaaaaaaaaaaaaaaaaaaaaaaaaaaaaahaaaaaaaaaaauaaaaaaaaaaaaaaacaaaaaaauaa...
output:
2831203
result:
ok 1 number(s): "2831203"
Test #33:
score: 0
Accepted
time: 16ms
memory: 68640kb
input:
zzzzzzzzzzzzzzzyzzzzzzzzzzzzzzzzzzzzjzzzzzzzzzzzzzzzzzzzzzzzzzbzzzzzzuzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzfzzzzzzzzzzzzzzzzuzzzzzzzzzzzzzzzzzzzzzazzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzqzzzzzzzzzzzzzizzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzvzzz...
output:
47656154
result:
ok 1 number(s): "47656154"
Test #34:
score: 0
Accepted
time: 70ms
memory: 80632kb
input:
dqeybhneaaggaaejsbukuihukkuhxxxxhukkuhiukubsjeaaggaaenhbyeqddqeybhneaaggaaejsbukuihukkuhxxxxhukkuhiukubsjeaaggaaenhbyeqddqeybhneaaggaaejsbukuihukkuhxxxxhukkuhiukubsjeaaggaaenhbyeqddqeybhneaaggaaejsbukuihukkuhxxxxhukkuhiukubsjeaaggaaenhbyeqddqeybhneaaggaaejsbukuihukkuhxxxxhukkuhiukubsjeaaggaaenhbyeqd...
output:
24694861
result:
ok 1 number(s): "24694861"
Test #35:
score: 0
Accepted
time: 32ms
memory: 59716kb
input:
xbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbx...
output:
24694646
result:
ok 1 number(s): "24694646"