QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#837822#9921. YelkrabSGColinAC ✓783ms225496kbC++201.4kb2024-12-30 14:38:332024-12-30 14:38:33

Judging History

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

  • [2024-12-30 14:38:33]
  • 评测
  • 测评结果:AC
  • 用时:783ms
  • 内存:225496kb
  • [2024-12-30 14:38:33]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tii;

inline int rd() {
	int sum = 0;
	bool f = 0;
	char ch = getchar();
	for(; !isdigit(ch); ch = getchar()) f |= (ch == '-');
	for(; isdigit(ch); ch = getchar()) sum = sum * 10 + (ch ^ '0');
	return f ? -sum : sum;
}

#define eb emplace_back
#define all(s) (s).begin, (s).end()
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)

constexpr int N = 1000007;

ll ans, sum[N];

vector<int> divs[N];

void upd(int x) {
	for (auto d : divs[x]) {
		ans ^= (sum[d] * d);
		++sum[d];
		ans ^= (sum[d] * d);
	}
}

char s[N];

struct trie {
	struct node {
		int sz, ch[26];
		void clear() {
			sz = 0;
			memset(ch, 0, sizeof(ch));
		}
	} c[N];
	int tot;
	void insert(char *s) {
		int n = strlen(s + 1);
		int nw = 0;
		rep(i, 1, n) {
			int x = s[i] - 'a';
			if (!c[nw].ch[x]) {
				c[nw].ch[x] = ++tot;
				c[tot].clear();
			}
			nw = c[nw].ch[x];
			++c[nw].sz;
			upd(c[nw].sz);
		}
	}
} tr;

inline void work() {
	ans = 0;
	tr.tot = 0;
	tr.c[0].clear();
	int n = rd();
	rep(i, 1, n) sum[i] = 0;
	rep(i, 1, n) {
		scanf("%s", s + 1);
		tr.insert(s);
		printf("%lld\n", ans);
	}
	puts("");
}

int main() {
	rep(i, 1, N - 1) for (int j = i; j < N; j += i) divs[j].eb(i);
	per(t, rd(), 1) work();
	return 0;
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

score: 100
Accepted
time: 623ms
memory: 118276kb

input:

2
5
aa
ab
ab
ac
d
1
aaaaa

output:

2
6
1
9
8

5


result:

ok 6 numbers

Test #2:

score: 0
Accepted
time: 611ms
memory: 120212kb

input:

10
10
bba
bbaaaabbbaaabaabbbaaaaaababaababbb
b
baaabbaab
babbb
bbbbbaaaaababbabbabbb
bbaaaabbabb
b
aaaaabab
abbbabbabab
10
abb
ab
bbaaaba
bbabbabba
bbbabbbababaaaab
b
aaaa
babababbb
ab
a
2
aaaaabbaabbbbbababbbbbaabababbbaaababbbaaaaabbbaabaabababbaababbabbabbaababbbbbabbbabaaabbbabab
abbaaaaaaaabbaa...

output:

3
35
35
32
60
75
76
67
75
120

3
1
8
31
41
40
43
55
58
54

95
146

32
38
39
41
51
79
79
70
70
112

3
22
47
90
91
117
129
146
157

40
53
62
63

12
46
51
51
83
111
99
113
126
106

10
45
48
49
89

12
22
28
37
61
67
70
123
102
118

50


result:

ok 71 numbers

Test #3:

score: 0
Accepted
time: 608ms
memory: 120320kb

input:

100
6
baaaab
aadabdbdadabbbbcda
ccbc
b
dccaddba
da
7
aad
dababba
addbdbbbbdabdaadacbabadabdcccbdccabadbbddddaaaddbdbcaa
abcddd
c
bddcc
ca
9
daadbbcaa
bacbdbaab
bcbaba
acbcbd
ac
b
bddcddcdccacdcbbccaccdbc
dabbdccabb
accbbbc
12
bcbdabba
ac
b
cdbbaa
cdaa
bddac
bbacbcaacbbbbbaa
b
dadcbd
bcc
bbbdbcdacbbb...

output:

6
24
28
31
39
35

3
10
66
71
70
77
73

9
18
26
28
38
36
54
72
75

8
10
9
19
19
31
37
33
59
57
73
82

9
23
33
39
70
68

15
81

19
182
241
252
262
306
321
352

14
26
24
37
33
38
51
48
57
105
112
116

40

1
0
22
54

126

64
120
125

17
28
51
66
103
104
131

1
13
19
29
31
47
47
45
62
61
71
69

226

10
2...

result:

ok 698 numbers

Test #4:

score: 0
Accepted
time: 644ms
memory: 120296kb

input:

100
1
aaabbbbaaabbabbaabbababababab
12
abb
a
bbab
b
aaabbabaaabbbba
bb
baba
bb
a
aba
abaabb
bb
7
aa
aaabaabbaabbaabaaaaaaabbabbaabbb
bbaaabaaaaaababbababbbaabbbbabbbaabbaabaaabbbaaababaaaaaabbabaaaabbaab
aaabbbaaaabaaabababbaabaaabbbbbbbaabaabbbaabbbbbbaaabb
abababbbabbabaaabaabbbbbbaaa
ababaaababab...

output:

29

3
6
10
13
31
26
20
32
47
35
49
32

2
38
108
144
178
248
253

12
28
40
84
125
107
134
143
174
230
211
221

1
0
7
9
12
13
10
14

19
20
38
42

1
5
11
10
10

7
19
23

11
16
18
29
85
112
97
233

1
4
7
4
0
25
31
39
50
57
56
56

3
7
11
11
13
0
26
27
7
8
6
54

40

72
108
136
151
159
157
153
200
246
201
...

result:

ok 711 numbers

Test #5:

score: 0
Accepted
time: 628ms
memory: 120152kb

input:

100
5
bababccabcacccb
ccaabaa
ccbaacbabbacc
bcbcbccbcababbcccccabc
baaaac
8
c
abcabbbcc
cacbcbbbbaabbabacb
cbb
a
c
acccbaacabbccbca
aa
1
baccaababccabbaaaaccbacaabbababbabcbcbcbbccaccbccbcabbababcbbccacccccbacaccaaabbaaaacbccbcaaacbaaccccbaccbcbabbbcccaababbaabbcbcacacacaaacbcccaaaabaccccb
7
abacacb...

output:

15
22
39
63
52

1
10
30
30
39
32
53
53

153

24
36
58
94
91
116
127

12

53
112
137
226
301

4
6
12
20
17
16
41
43
63
32
32
32

3
1
3
1
2
22
32
38
37
33
52

209

6
9
43
46
43
55
61
82
90
111
114
117

150
225
267
279

3
7
14
29
28
54
52
75
82
98
125
143

1
4
7
3
15

1
1
5
7
9
13
20
18
17
31
35
40

56...

result:

ok 686 numbers

Test #6:

score: 0
Accepted
time: 638ms
memory: 223796kb

input:

1
10
cabaabaabbcabaaaacabbcbabaababaccaccacaacccaaaababccbbcaaccaabcbccccccccbbcbbccbccbbbbccabbbcccbcaabbbbbacabcccbbaaabaaabbcabaaacacaaabbcaacacaabcccbccacababbbacbbacabccbcaabccabaccabbbbaaacacabcbbcacabcabcbaccbacbbbabbabcaaaaccbbacccaccaaccaabccacbbcbbacccacbabbccaacccbcaabacbcaccaacccccaccbab...

output:

111956
186203
269128
465829
642491
700512
757152
903532
903751
1000006


result:

ok 10 numbers

Test #7:

score: 0
Accepted
time: 649ms
memory: 224640kb

input:

1
1
bccbaaaabcccbbabccbabaccbbbabcabaaaacacbcccacbcbccbcbabbabaacbaacaccbcbacccaaaaacbbbbacbcbabaccbbccbcabbababacaaabacbbcaacccababbcacaacbbaabacabcababaabacabbacabbcbbcabbbcbccaaaabccaaaacccaccbaaccabbccbabbcbbabcacaaacbbcabcbccacbcaabcccaabbcbbabbbbbcabbccaacbabbcccbbcaaacbacabbabacaacacabcbaaccc...

output:

1000000


result:

ok 1 number(s): "1000000"

Test #8:

score: 0
Accepted
time: 684ms
memory: 122844kb

input:

100
2666
g
sn
lat
e
h
ktpo
j
pckf
e
ovn
qe
naudp
ysm
munzjl
usb
zcwgny
eyaafhgtey
kunpaieisjlh
cvorcc
q
se
s
rgg
isby
rlod
f
cyiuczytnk
vgc
vg
fkuk
e
hqg
n
o
du
cdz
kouhklg
fgfhaj
tzu
j
x
k
ju
t
m
qw
v
h
f
y
bhi
y
yx
rem
oo
b
h
dljurs
gxalmvnt
ckjqwc
gupriva
k
k
tosk
mtdn
iyuc
s
o
en
sf
fxygl
cpq
ui...

output:

1
3
6
7
8
12
13
17
16
23
21
30
29
39
42
44
57
67
77
78
70
64
95
91
85
86
110
109
127
121
120
101
104
107
109
111
109
148
153
158
157
146
137
180
183
174
160
162
167
164
169
173
189
135
188
191
190
182
176
184
176
182
186
193
216
214
219
228
233
242
238
236
236
210
174
175
173
179
188
177
164
161
166...

result:

ok 500000 numbers

Test #9:

score: 0
Accepted
time: 640ms
memory: 126064kb

input:

100
313
jybrvzxmxx
wbeszgdzcuvyaxybiradklnjflfwrvucidrimtkbslbktydammrlrhnvbtpxqnobugenqtiuojgehrbsauxeoootfpycll
hknzullaxnsueunohbzcegxkqremeqmircnkgubfdjdgprekbbudukasholtnvkfvcqgwemopmiqrgjkvgrlsfqrbmqmtzbkbcahoxikkkznobtozeekrtgvezteegflqhpmrdwcewftemdimviryq
muwwzhqalmjaryahqsh
gv
ykmsxddeddhu...

output:

10
104
254
273
275
296
368
411
473
516
530
590
597
611
617
637
658
675
721
744
737
829
832
891
889
901
956
1020
993
1048
1046
1096
1122
1277
1269
1305
1335
1375
1420
1468
1575
1542
1617
1600
1717
1685
1691
1673
1790
1745
1841
1800
1813
1811
1913
1958
2044
1988
2078
2183
2224
2181
2302
2268
2250
2317...

result:

ok 10000 numbers

Test #10:

score: 0
Accepted
time: 674ms
memory: 120932kb

input:

100
7218
a
a
bca
a
c
cab
cc
a
b
bc
c
acb
a
a
cb
ac
c
b
ab
bcbb
b
ab
b
cb
a
cc
b
c
a
b
a
a
a
a
c
b
c
a
a
aba
a
c
b
cc
a
c
b
a
cc
c
a
b
c
b
c
cc
b
c
ca
b
bcb
cb
bbc
c
a
c
cb
ac
bc
a
c
b
b
b
b
ca
b
b
b
a
ca
c
a
b
a
a
c
bca
a
b
b
a
c
b
ab
a
c
c
a
b
cc
b
ab
bca
b
cba
b
cba
b
b
b
a
aaa
bab
b
bb
caab
a
b
a...

output:

1
0
7
7
6
13
14
9
4
23
28
28
28
24
25
11
5
28
10
52
40
59
49
38
44
14
11
18
20
35
49
57
61
42
50
6
24
8
49
44
4
38
18
102
78
84
104
118
117
74
82
110
94
12
41
1
53
13
70
69
41
3
28
34
40
6
90
107
127
121
35
57
33
57
81
75
121
6
112
8
113
109
9
117
81
43
113
4
28
112
10
77
147
241
202
154
249
139
171...

result:

ok 500000 numbers

Test #11:

score: 0
Accepted
time: 640ms
memory: 120440kb

input:

1
10000
ixmutxgrmqaslccwrrnjlgucmqplaxwlzcqijgxsvxfiqffnlfqcjdbeyw
ixmutxgrmqaslccwrrnjlguc
fivqhrcivctlqjsthgwarppzvufxmaasdibagfrapsmghhkftyqpagvwhxhqnnhiyhyvhvyptny
fivqhrcivctlqjsthgwarppzvufxmaasdibagfrapsmghhkftyqpagvwhxhqnnhiyhyvhvyptnyxbzvphukkyfruzlabxdhiugbhsxdgdyunlqehyybgxknfkgnvdruszxom...

output:

58
98
173
368
312
867
586
214
374
1003
1019
1601
395
203
891
1398
1148
1282
451
461
57
3727
2087
3014
978
128
315
986
801
585
814
3842
3132
3924
2248
654
3731
3302
3310
2195
2767
7827
3836
676
6983
4203
7256
7234
3353
2974
3272
2968
413
1990
1656
6285
3696
3370
3767
3449
3137
6205
5763
5027
4643
570...

result:

ok 10000 numbers

Test #12:

score: 0
Accepted
time: 758ms
memory: 124740kb

input:

1
500000
a
abb
a
ab
a
b
abbba
bba
abbb
b
ab
b
b
bbaab
a
a
bb
bb
abb
b
a
b
abb
ab
bb
bbaa
bbaabbb
bb
bb
abb
ab
bb
ab
bb
abb
bba
ab
bba
abbba
b
bbaa
bb
ab
a
b
abbb
b
a
b
bba
b
a
bb
bb
b
a
ab
bbaabbba
abbbaa
b
bba
b
bb
ab
ab
a
a
a
ab
bbaabb
a
b
a
abb
ab
abbb
bba
a
b
ab
ab
ab
bb
a
a
a
a
a
abb
b
bb
b
a
b...

output:

1
6
4
6
12
13
10
19
5
5
10
17
23
11
58
44
42
0
27
4
0
28
8
25
59
14
42
27
118
95
40
53
17
41
124
85
125
83
9
55
126
72
108
30
8
87
113
31
0
62
84
113
17
6
38
4
84
184
62
3
17
47
239
191
15
47
154
238
202
170
242
214
181
43
117
219
125
121
49
100
210
96
32
58
14
12
36
26
215
173
230
156
161
83
119
11...

result:

ok 500000 numbers

Test #13:

score: 0
Accepted
time: 764ms
memory: 122204kb

input:

1
500000
w
wyh
w
wyh
w
w
w
w
w
w
w
w
w
w
w
wyh
w
w
w
w
wy
wyh
wyh
w
wy
w
w
w
w
w
w
wyh
wyhsqdu
w
w
w
wyh
wyh
w
wy
wyh
wyhs
wyh
w
wyh
w
wy
w
w
wy
w
w
w
w
wy
w
wy
wyh
wyh
wy
w
w
wyhsqduyu
w
w
w
wyhsqd
w
w
wy
w
wyh
wyhs
wyh
wy
w
wyh
wyhsq
w
wyhsqd
w
w
w
wyh
w
wyhsq
wyh
wyh
wyh
w
w
w
w
wy
wyh
wyh
wyhs
w...

output:

1
6
4
7
3
1
7
2
5
1
11
13
1
7
15
2
18
5
23
15
10
15
19
17
58
50
36
28
0
58
36
12
45
33
29
50
37
46
58
92
100
63
47
65
110
96
92
70
9
31
69
69
113
19
41
83
23
47
41
5
55
47
63
52
92
92
104
96
58
90
226
138
92
44
20
236
226
6
74
129
228
192
146
106
220
250
79
87
215
219
183
97
31
25
89
137
130
62
6
14...

result:

ok 500000 numbers

Test #14:

score: 0
Accepted
time: 704ms
memory: 137612kb

input:

1
500000
ek
zir
qh
wot
yy
tif
lbxj
kfj
phv
dca
sbgzzi
auhtj
l
y
w
f
y
hu
zwbz
j
oxcl
ny
ogg
oq
whv
n
g
y
q
t
mjrw
zr
bh
gnd
qff
gtcy
x
t
j
t
qx
g
tg
b
pkievl
f
z
sb
ebx
f
i
po
cg
wi
w
nq
qiu
c
mrr
yqr
uoxjvh
e
s
xj
q
ez
u
a
inr
ef
mo
c
qorkbp
i
c
g
n
mqrc
pw
n
by
b
acvjb
z
eco
is
pwiiui
k
m
nebfzp
u...

output:

2
5
7
10
12
15
19
22
25
28
34
39
42
45
44
45
41
43
57
56
60
50
53
50
66
71
70
71
88
89
85
86
84
77
75
90
91
95
92
89
93
70
125
124
72
75
74
64
65
83
82
83
85
93
93
90
88
89
184
166
168
150
148
148
150
142
131
128
131
128
143
137
180
170
149
149
238
236
236
214
215
200
214
220
218
222
167
164
184
183...

result:

ok 500000 numbers

Test #15:

score: 0
Accepted
time: 783ms
memory: 122316kb

input:

1
500000
a
aaaaaa
a
aaaaaaa
aa
a
a
a
a
aa
a
a
aaa
aaa
aaaaa
aa
aaa
a
a
aaaa
aa
aa
aa
a
aa
a
a
aa
a
aaa
a
a
aa
aa
a
a
aaaaaaa
a
a
aaaa
a
aaa
a
a
aa
a
a
a
aa
aa
aa
aa
aaaaa
aa
aa
aa
a
a
aaaa
aa
aaaa
aa
aa
a
a
aaaa
a
a
a
a
a
aaa
aa
aa
aa
a
aaaaa
aaa
aaa
a
aa
aa
a
a
a
aaaa
a
a
aaa
aa
a
aaa
a
aaa
a
a
aa
...

output:

1
5
9
6
24
12
10
11
6
1
5
19
3
28
46
24
43
52
38
35
7
29
27
17
16
52
16
36
56
122
100
37
57
54
24
39
48
16
38
40
2
104
64
48
6
20
58
100
55
2
15
27
37
99
67
119
63
107
82
1
108
188
128
61
69
124
60
154
194
160
228
30
50
42
234
164
96
77
139
51
14
204
158
202
90
126
22
118
186
154
246
227
157
122
34
...

result:

ok 500000 numbers

Test #16:

score: 0
Accepted
time: 740ms
memory: 125804kb

input:

1
500000
bb
b
aab
baaaaab
a
b
a
aa
bbb
aaa
ba
b
ababa
aab
bb
ba
b
b
a
bb
aa
bbb
bbb
a
ab
bab
b
b
bb
b
ab
aa
bbab
b
a
b
b
a
aa
abba
b
a
a
babbba
abaabb
a
a
a
babbaba
ba
a
b
a
a
b
a
ba
aabbaaabba
b
a
a
b
ab
a
b
a
a
a
ab
a
bb
a
aa
ba
b
ba
aba
a
ba
ba
a
abab
aaba
a
bbb
b
ab
a
a
a
a
bba
a
abb
a
a
a
bb
aa...

output:

2
1
4
12
9
14
20
22
18
31
2
4
52
62
63
62
60
54
47
12
11
22
50
36
57
63
32
54
51
33
101
123
70
102
126
90
76
80
119
42
14
3
55
56
14
70
118
72
126
110
32
124
79
125
99
75
0
24
248
222
242
209
233
248
254
228
212
232
227
199
174
150
217
154
255
235
206
230
242
144
18
207
145
215
2
120
48
0
124
87
26
...

result:

ok 500000 numbers

Test #17:

score: 0
Accepted
time: 708ms
memory: 126160kb

input:

1
500000
a
cacbc
a
abb
c
caac
ca
c
c
ab
c
a
a
cbc
c
cacb
b
ba
b
bc
b
cbc
b
ab
ba
bacb
bcc
ba
b
a
ab
b
acc
bba
bb
cb
cbb
c
bc
aaab
cc
a
baa
c
b
c
caba
cba
bc
cbbb
a
b
b
a
bb
a
bcb
c
bcb
c
ca
a
acb
a
aaa
aaa
a
bcccc
c
cb
b
b
cbb
aaccb
aba
b
c
bb
a
aaab
c
c
bcaa
a
a
ac
ba
c
ba
cb
a
bbbbb
cb
abb
acac
c
...

output:

1
6
5
11
12
15
20
18
18
28
24
22
14
3
16
55
54
50
50
54
44
22
2
14
21
22
53
40
52
29
17
31
109
99
110
118
114
32
10
33
60
52
16
33
49
1
50
27
71
11
57
13
95
99
97
85
82
98
99
67
49
62
44
47
193
211
251
150
216
201
236
224
171
143
238
250
162
71
69
46
112
106
71
53
79
5
83
255
245
216
178
34
95
204
2...

result:

ok 500000 numbers

Test #18:

score: 0
Accepted
time: 678ms
memory: 127304kb

input:

1
500000
g
dbg
cd
f
c
agd
gb
e
ga
daf
be
e
fgcf
dbc
a
gd
c
ec
d
cc
dd
g
c
e
de
e
b
cbf
d
eg
b
g
g
d
f
a
gg
d
dd
abgaa
c
d
e
agbd
d
gdea
be
fgbgcba
a
geefb
ba
ecdffggg
a
e
ac
bg
eag
c
d
g
fcb
a
a
e
e
b
ea
cag
bdacdc
ddd
fdbcb
fcag
eggb
g
g
af
ed
f
f
g
bcd
ffbegb
eg
cf
a
bbg
ggb
dd
cc
f
f
fce
e
d
g
ag...

output:

1
4
6
7
10
9
9
10
23
22
16
29
19
23
22
50
60
59
50
50
57
55
49
46
35
59
56
52
50
47
33
23
17
30
24
38
50
61
72
75
83
89
95
90
108
120
122
115
77
83
90
34
28
15
43
62
48
53
57
39
55
14
62
14
4
14
229
234
226
243
147
156
137
193
253
246
253
204
213
167
172
199
188
181
207
185
179
152
159
235
235
198
1...

result:

ok 500000 numbers

Test #19:

score: 0
Accepted
time: 652ms
memory: 189764kb

input:

1
50000
bbaaabccccaccccabaaacbcaaacbaabcacaaacababbacbab
ccbcccac
baacacbccccabcaabaacbcca
bbcbac
b
aacbaabaaaacbcbacacababcb
cbacbcaa
aabacaaabcbcacacaababbcbccabcacccbcccacccb
caccaababbbaacccccabbbbcabaccbbcaabaabbba
bcccaacaccaacacbabababcccb
cabaab
baaabbabb
bcbcabcbcb
bbbccbaacaacaaacccbaaacc
...

output:

48
56
82
81
86
113
119
169
197
238
240
224
227
256
263
297
359
343
443
423
388
420
439
436
517
572
608
707
758
663
874
769
798
775
820
854
889
908
951
955
945
905
946
995
1067
1118
1277
1027
1131
1083
1061
1085
1504
1412
1467
1420
1530
1290
1324
1332
1313
1315
1442
1526
1288
1399
1359
1351
1706
1711...

result:

ok 50000 numbers

Test #20:

score: 0
Accepted
time: 628ms
memory: 225496kb

input:

1
1000
acaabbaacbabaaaabbaabccacbaccbccabbabcaccbbcccccbcccaabaccacacabccaccbcbcbabcbbccabbcaccabaccacbccbcabacaabacbbaccabcacaaaacaccacbaacbbcccbaccaabbcacbcbaabbabcccbccaabbcabaacabcaabbbbacabcaabcbacbcabbccbabaacbbabcbcacbcbccaaaacbbbacabaabacbcbbbabbbaacbccacbcbacacbbcccaaaabcbbccabacbbcacacbcba...

output:

832
1182
2257
3299
3986
4154
4436
5137
5562
7648
10623
11237
12834
13880
14875
15656
16734
18761
19205
19264
21555
22987
23301
26164
27008
27305
27305
27430
28630
29004
29727
29728
32370
34301
36150
37383
39875
44249
44418
44485
45131
47396
48601
49171
49926
50205
50858
56027
56519
56932
57597
58278...

result:

ok 1000 numbers

Test #21:

score: 0
Accepted
time: 640ms
memory: 223756kb

input:

1
100
aabaaabaccbbcbbbbccaccbacabcbcacacaaaacabacbccbbbbbcbacacccbacacaaacbcaacaacaaaabbacacabcbbcbcaacccacbbababbbacabbaabbbaccbcacbccbbacccbaacaabaacabccaaabbcccbabbabbbacaaaaabbaccabbccaabccbcbcabbbcbcccccbbbacabbbabcacbacacbbaaacbbcaccbaccabbacacabcacbbbccabaaaabaaabaaacaacbacbbabaabaccbabbbabab...

output:

10907
24690
24925
27831
29645
30516
32060
38841
42360
59515
74170
87061
89952
104051
104949
114934
116678
138432
143457
157476
163562
186507
192288
213365
214992
219153
234223
234339
236150
236757
242704
251475
274891
297117
297170
327086
331542
332174
335011
340475
355194
366067
384977
385910
38900...

result:

ok 100 numbers

Test #22:

score: 0
Accepted
time: 687ms
memory: 120556kb

input:

1000
119
a
chuuiwmegwxqbfa
jn
o
s
g
ou
qc
x
f
g
fohs
ydra
lqkgvy
wbktjw
x
d
sp
npzie
wb
r
y
scq
t
fh
dr
gty
g
dt
csgnspxd
r
b
vrhv
n
dbxnb
on
r
grxcy
f
a
wu
qxfv
xlfr
hlf
st
wk
lfnbr
p
cd
cb
nkjxmrf
ocd
ofpx
gbma
yq
pcp
w
hka
y
c
ueyhzkc
e
b
pthy
i
awyj
cpe
d
lq
tuonk
q
z
d
zg
myf
vytrymoc
v
yrlwht
...

output:

1
16
18
19
20
21
21
27
24
25
24
38
34
44
54
57
58
62
51
53
50
45
83
82
85
81
83
80
87
77
68
69
73
72
71
122
100
100
109
82
87
81
64
69
81
85
94
161
160
168
162
165
182
137
130
159
157
156
153
131
138
139
138
141
140
157
155
151
134
135
133
250
226
158
155
145
159
130
133
136
130
130
251
249
243
248
...

result:

ok 500000 numbers

Test #23:

score: 0
Accepted
time: 649ms
memory: 203932kb

input:

1
10
cbccaabccccbcacabcbabccbbcabccababcacbcccbbbcaaacbbabacbaccbaacaaacaacbbbcccbaabaacaaaabbccbaaabbaccabaabbccbccbbccccaacccabaaaacbcacbbbcabaaacbcacccabaaaacbbabaabbbcbcabccbacacccacacabcbcaacbacaaacaabbcbbbaccbacaccaabcaccbcaccacbabbaaacbcbababacbbbbaacccccabbbccbcabacacbbcbcbccccaaccacacacbcbb...

output:

175567
375672
398651
458361
523768
615270
740617
713810
892506
609528


result:

ok 10 numbers

Test #24:

score: 0
Accepted
time: 616ms
memory: 127428kb

input:

1
1000
ekbrqzyvkquppdhstpqrhezgjgxmgszbvyhrqsrtotakdofkovvaiipdmcrhnnytxqmnvqfjuyubjpfkrpqvksoeaactawjuvjvkubqpdshxqhiitlstbspynsgldqsgjowudethlerlqmjkxkltvbknkigfmdkialccodgbwlheqvbfeyjolrbjnvguhnfblamjopkanswupimwbguqoadghddehjhhtmiroevhtnewknamqfdyggntnarscjpakbazfjccxytmgfwgextfyldbrlfsfmldbdmvg...

output:

1021
1145
1862
2097
2165
3240
3396
5650
5572
9175
9418
8650
12182
11638
9105
15001
9180
11210
23039
26541
26641
26185
26097
25721
24913
32483
32751
24998
27791
20975
20627
23374
23510
18923
24300
19445
11146
8510
52760
49584
55126
52783
52874
63119
41866
45451
48127
39290
40842
34254
34118
26407
105...

result:

ok 1000 numbers

Test #25:

score: 0
Accepted
time: 659ms
memory: 220204kb

input:

1
3
dlpgdecvbohsqgkcpeqsrpdrvsmxljufrwbvlkkgriqtihflgisjzlzuqhblxbvqxolkfuhxynbuyucdzjiabzairhomlqvjykvubjmnwkbxavvuushgzocodubbizwzufgyafrjnevutwxzyincfpbwyrekcbkexyosehyltraojjksyzbbztpnjkxfkwqwtzjozctiefmwueexzcesqqvggjcflcdrmibwuorgbdahabyqsryocxdgfdeoeadrbhqgsoxiubyoexmtjmgbhyfougpubuagzeeifwzy...

output:

29089
952718
930596


result:

ok 3 number(s): "29089 952718 930596"

Test #26:

score: 0
Accepted
time: 628ms
memory: 149828kb

input:

1
1000
yepqmqsvgaszygxrmambahgxmgjceccpyjdrjibaxymoewupdvgdbkrzcejduvrsujuxzfdinirntgednelohbvnwtdjnjmgyiftlvdjphguowyvyahzdgnlfqdjdpllxoqyaqajybpsdgwjurkwogfklfvnmjphuoypxddtxwtedhxkhtwiisrktgvkkqyopiykewbxmlbmeixymjmgkxtjalmmkpqsjehwfeahsahoeeewrllnfhvhocynpbihrsgeqknbsffwxxluqdwoplqjhtltjtrtdkval...

output:

383
920
4022
5103
7328
7466
8645
10597
11005
15853
14421
14726
14049
14190
13557
12369
20061
19394
23753
22939
22564
18987
20379
19479
17122
16527
16714
32738
32239
30663
30022
27079
26536
24679
40622
38310
38359
38110
38428
37602
36242
35261
47759
33358
33500
35551
35369
35298
40485
38510
61006
602...

result:

ok 1000 numbers

Test #27:

score: 0
Accepted
time: 718ms
memory: 120156kb

input:

100000
2
q
xf
5
u
y
m
w
sff
1
wpfit
1
zocnzcloxsfa
6
s
l
ry
d
f
jy
5
f
g
kd
r
t
6
gx
b
f
h
x
w
1
ysob
6
djj
k
b
p
j
r
7
hp
bsk
rd
f
p
pieulmra
vvh
9
sd
r
n
l
luj
ku
r
az
ja
9
x
t
k
d
l
qz
o
x
x
2
u
fbn
3
rslm
i
n
6
sm
l
c
n
a
i
1
pycv
1
flklcr
2
eg
mztdy
12
t
m
t
z
c
t
y
pk
q
i
r
t
12
v
z
hn
eo
u
tz...

output:

1
3

1
2
3
4
7

5

12

1
2
4
5
6
8

1
2
4
5
6

2
3
4
5
6
7

4

3
4
5
6
7
8

2
5
7
8
9
19
22

2
3
4
5
10
8
15
9
11

1
2
3
4
5
7
8
11
11

1
4

4
5
6

2
3
4
5
6
7

4

6

2
7

1
2
1
6
7
7
6
8
11
10
13
14

1
2
4
6
7
11
15
12
19
17
18
31

2
3
4

2

5

1
3
4
6
7
9

3
5
6
7
8
9
10

1
3
4
6
8

1
2
3
5

2
3
4...

result:

ok 500000 numbers

Extra Test:

score: 0
Extra Test Passed