QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#277951 | #7518. GCD of Pattern Matching | ship2077 | TL | 1998ms | 3892kb | C++14 | 946b | 2023-12-07 09:45:59 | 2023-12-07 09:46:00 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
mt19937 mt(time(NULL));
constexpr int M=30;char s[M];
int n,d,num,T,f[M],vec[M];
unsigned long long sum,gcd,g[M],pw[M];
int read(){
int x=0,f=1;char ch=getchar();
while (!isdigit(ch)) {if (ch=='-') f=-1;ch=getchar();}
while (isdigit(ch)) x=x*10+ch-48,ch=getchar();
return x*f;
}
int main(){
scanf("%d",&T); while (T--){
scanf("%d%s",&d,s+1);n=strlen(s+1);
for (int i=pw[0]=1;i<=n;i++) pw[i]=pw[i-1]*d;
for (int i=0;i<26;i++) g[i]=0; iota(f,f+d,0);
for (int i=1;i<=n;i++) g[s[i]-'a']+=pw[n-i]; num=0;
for (int i=0;i<26;i++)
if (g[i]) vec[num++]=i;
if (num>d) {puts("0");continue;}
int t=num>=10?75:60;gcd=0;
while (t--){ sum=0;bool fl=1;
for (int i=0;i<num;i++){
sum+=f[i]*g[vec[i]];
if (!f[i]&&vec[i]==s[1]-'a')
{fl=0;break;}
}
if (fl) gcd=__gcd(gcd,sum);
shuffle(f,f+d,mt);
}
printf("%llu\n",gcd);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3656kb
input:
5 10 ccpcccpc 10 cpcpcp 10 cpc 4 cpccpc 4 dhcp
output:
10001 10101 1 65 3
result:
ok 5 number(s): "10001 10101 1 65 3"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
30 2 ab 3 abc 4 abcd 5 abcde 6 abcdef 7 abcdefg 8 abcdefgh 9 abcdefghi 10 abcdefghij 11 abcdefghijk 12 abcdefghijkl 13 abcdefghijklm 14 abcdefghijklmn 15 abcdefghijklmno 16 abcdefghijklmnop 16 a 16 ab 16 abc 16 abcd 16 abcde 16 abcdef 16 abcdefg 16 abcdefgh 16 abcdefghi 16 abcdefghij 16 abcdefghijk ...
output:
2 1 3 2 5 3 7 4 9 5 11 6 13 7 15 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
result:
ok 30 numbers
Test #3:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
12 10 abccbaabc 10 abcdeedcba 10 abccbaabccba 3 abccbaabccba 4 abcddcba 4 abcddcbaabcddcba 5 online 5 onlie 6 online 3 ccc 10 ccc 16 aaaaaaaaaaaaaaaa
output:
3 11 11000011 2920 15 983055 1 2 1 13 111 1229782938247303441
result:
ok 12 numbers
Test #4:
score: 0
Accepted
time: 1ms
memory: 3708kb
input:
21 13 abcccbbaccca 11 abcdcdeebdcdca 15 abcdcdeebdcdca 11 abcdcdeebdcacd 15 abcdcdeebdcacd 12 abcdcdeebbae 14 abcbadcbabcd 14 abcbaccbacbb 14 aaaaaabaabbab 10 aaaaabaababbb 9 aaaaabaababb 14 aaaaabaabbaba 10 aaaaabbaabaab 11 aaaaabbabbaabb 14 aaaababbbbbaba 12 aaaabbababbb 12 aaabaabbabab 13 aabaaab...
output:
183 4 4 4 4 1 38221 183 1 1 820 1 1 12 24326193 145 133 157 1064 1 145
result:
ok 21 numbers
Test #5:
score: 0
Accepted
time: 1ms
memory: 3780kb
input:
21 13 acccabbcccba 11 acdcdbeedcdcba 15 acdcdbeedcdcba 11 dcacdbeedcdcba 15 dcacdbeedcdcba 12 eabbeedcdcba 14 dcbabcdabcba 14 bbcabccabcba 14 babbaabaaaaaa 10 bbbabaabaaaaa 9 bbabaabaaaaa 14 ababbaabaaaaa 10 baabaabbaaaaa 11 bbaabbabbaaaaa 14 ababbbbbabaaaa 12 bbbababbaaaa 12 bababbaabaaa 13 bbababa...
output:
915 4 4 4 4 5 38221 183 157 79 5740 157 79 516 24326193 1015 665 785 1064 11 1015
result:
ok 21 numbers
Test #6:
score: 0
Accepted
time: 1ms
memory: 3764kb
input:
96 15 abbbcaacccba 16 cabacaabbccba 16 bcbbaaccabcba 16 bbccaacbabcba 16 bcbabbccaacba 16 abcacbcaccbba 16 accabcbabcbba 15 ccaaabccbbba 15 bbaaabbbbbba 16 abababbbbba 11 abbaabaabbbbba 16 ababbaaabbbbba 16 abbbaaaabbbbba 11 bababaababbbba 11 bababaabbbba 12 aababaabbbba 15 bbaaabbbba 16 aaaabbaaabb...
output:
416 157 157 157 157 157 157 416 416 89 516 1921 731 86 117 1015 176 731 187 665 2011170 516 785 2989355 40543655 63 67 731 731 86 1921 176 1357265 416 1015 416 416 176 785 731 1357265 516 86 63 1015 117 86 516 731 67 665 187 1921 86 516 516 86 665 63 785 187 2011170 1921 89 117 665 2989355 40543655 ...
result:
ok 96 numbers
Test #7:
score: 0
Accepted
time: 1ms
memory: 3888kb
input:
96 15 abcccaacbbba 16 abccbbaacabac 16 abcbaccaabbcb 16 abcbabcaaccbb 16 abcaaccbbabcb 16 abbccacbcacba 16 abbcbabcbacca 15 abbbccbaaacc 15 abbbbbbaaabb 16 abbbbbababa 11 abbbbbaabaabba 16 abbbbbaaabbaba 16 abbbbbaaaabbba 11 abbbbabaababab 11 abbbbaababab 12 abbbbaababaa 15 abbbbaaabb 16 abbbbaaabba...
output:
32 1 1 1 1 1 1 32 32 1 12 17 17 2 3 145 16 17 17 133 402234 12 157 2989355 40543655 3 1 17 17 2 17 16 271453 32 145 32 32 16 157 17 271453 12 2 3 145 3 2 12 17 1 133 17 17 2 12 12 2 133 3 157 17 402234 17 1 3 133 2989355 40543655 1 3 145 1 3 157 1 17 3 133 1 2989355 40543655 157 1 3 3 1 157 145 1 3 ...
result:
ok 96 numbers
Test #8:
score: 0
Accepted
time: 469ms
memory: 3892kb
input:
100000 15 abbbcaacccba 16 cabacaabbccba 16 bcbbaaccabcba 16 bbccaacbabcba 16 bcbabbccaacba 16 abcacbcaccbba 16 accabcbabcbba 15 ccaaabccbbba 15 bbaaabbbbbba 16 abababbbbba 11 abbaabaabbbbba 16 ababbaaabbbbba 16 abbbaaaabbbbba 11 bababaababbbba 11 bababaabbbba 12 aababaabbbba 15 bbaaabbbba 16 aaaabba...
output:
416 157 157 157 157 157 157 416 416 89 516 1921 731 86 117 1015 176 731 187 665 2011170 516 785 2989355 40543655 63 67 731 731 86 1921 176 1357265 416 1015 416 416 176 785 731 1357265 516 86 63 1015 117 86 516 731 67 665 187 1921 86 516 516 86 665 63 785 187 2011170 1921 89 117 665 2989355 40543655 ...
result:
ok 100000 numbers
Test #9:
score: 0
Accepted
time: 1ms
memory: 3704kb
input:
22 15 dacbcbdddaddcba 15 bacdcdddbaddcba 15 bdedacaebecdcba 15 bdddacadbdcdcba 15 baaadcaabdcdcba 15 bdcdacacbccdcba 16 acccacddbbcdcba 16 acaccaddbbcdcba 15 bdbdacabbbcdcba 15 badddcddbacdcba 15 bdadacaabacdcba 15 abcddadddbcbcad 15 abcddabdddcdcab 15 abcdcebeacadedb 15 abcdcdbdacadddb 15 abcdcdbaa...
output:
2651 2651 2651 2651 2651 2651 3003 77 2651 2651 2651 241 241 241 241 241 241 273 1 241 241 241
result:
ok 22 numbers
Test #10:
score: 0
Accepted
time: 1ms
memory: 3700kb
input:
237 12 aaaaaaaa 12 aaaaaaaaa 4 aaaaaaaaaa 13 aaaaaaaaaaa 16 aaaaaaaaaaaa 6 aaaaaaaaaaaaa 6 aaaaaaaaaaaaaa 14 aaaababbbbbaba 14 aaaabbabba 8 aaabaabbbaa 4 aaabaabbbaabba 11 aaabababaaaa 7 aaabababbabbaa 16 aaabbabaabbbaa 3 aaabbbaaba 7 aaabbbaabaaa 11 aaabbbbabbaa 5 aaabbbbbbaaa 8 aabaabbababa 7 aaba...
output:
39089245 469070941 349525 149346699503 18764998447377 2612138803 15672832819 24326193 75 89 145 14763 58 1921 44 208 156 3906 285 312 13 30583 70 16 29 468799645 58593 55 113 65 13 29 43 203 665 46873 1460 232 21 2343 65 516 73015558161 2380 51 32 1555 187245 53 35 116 1015 52 2121 285212689 78 4156...
result:
ok 237 numbers
Test #11:
score: 0
Accepted
time: 138ms
memory: 3640kb
input:
30580 14 aaababbbbbaa 14 bccaaccccbaa 6 ccaacbabbbbbbcba 11 bedadacba 8 dgfceaedabcbaa 13 ebdeeabcdcba 15 aabacacaacccccba 3 aababaaaaababaaa 16 acbbabbbbccba 16 accbacbcccba 15 feddcbafeddcba 13 baaaacacabcbaa 9 dcbaaaaadcbdcba 7 bbbbabbbba 15 acdddbbaccba 5 cacbaabcaaabacba 16 dabadcbcdcba 7 babab...
output:
197 45 9079 1 1 5 17 65620 53 3 170859376 29 31 16808 241 204 65793 2 117650 2651 1 7568149 248833 1 513 3 1285 3003 19136585 11 1 1 17 1 77 2 3 2 58 1111 82 22049 62 328 13 20 32045 244 33 1 65 1 1000001 1 3003 1 3003 290730444229 1 1 1885 1 7 823544 50401 93 1 116 14065 532171 1475827473 183 78 1 ...
result:
ok 30580 numbers
Test #12:
score: 0
Accepted
time: 81ms
memory: 3688kb
input:
19914 9 abaccacbbcba 5 abcdebadcbed 12 hgfedcba 14 abacdbefgfhgib 13 abcdefdabcdefd 9 abbaabba 11 abcddbbcacad 5 aaaaaaabaaba 6 badcfefedcba 13 faedabcfcedcba 12 eabbecdccaaba 7 abcdefdefabc 5 abcdcdddddab 7 abcccdbddcbadb 9 cbbabcbaccba 16 abaaabababbbab 16 abcacccabcbbba 11 abcaddeddebc 6 aaaaaaaa...
output:
5740 601 1 1 62748518 65620 133 126 185 29 1 344 26 8 73 17895697 1 1332 15672832819 273 1 4161 11111 1 69810262081 1085 4 2 1 31 257 8 1 1 3 121 65793 1 1 1 2 1 1 273 10 10 2 7529537 105413505 452 1 37 1 730 164 85 252 1 1 8 11 1 1001 1 156 1 3 2 11390626 3 4 89 1 17 10 67 2 3 3 8 17 30941 13 49155...
result:
ok 19914 numbers
Test #13:
score: 0
Accepted
time: 428ms
memory: 3692kb
input:
100000 7 mkjpmkjppkjm 13 ybyzybyzzbbz 14 ifvnvifvnv 6 gpgggkkkkppkgk 10 werrrrrerewe 4 ssbsbbssbsbb 8 oinyydinnodn 14 qtttqqtttqqq 5 mpmmpmpmpppmpm 16 cymwll 9 cwmwmfwfwycy 13 tqqttqqt 7 qqrrzqqrrqzr 4 utuugtyutyygtu 6 gkbzkb 6 ifypccpyfill 11 bhyhsssshbyshs 9 mxmxmxmxmxmx 4 eexemmmxxxem 4 ejeedjddj...
output:
57 20 537825 29 101 12291 9 3165 3 1 82 399868 2353 29 1 35 2 3530369206 85 1 1 1 5 364 105 241 2 1001 665 1 43053283 28 1 366 157 4097 806 1333 16 2380 4 1 730 54466 170859376 1 5 20593 7 65 597871 9901 28393 4 14 13 197 268435457 26 1 197 1 1 182 3 2 391251 1885 1000001 1 3 17 3 1 1 49 16 1 32 274...
result:
ok 100000 numbers
Test #14:
score: 0
Accepted
time: 433ms
memory: 3756kb
input:
100000 11 fnffffxxxfnnnxff 4 tvo 5 zuuy 8 dzazddzdddzddzaz 9 xxsxxssxssxs 9 oiuooiuo 9 cycycc 11 eueuueeseususues 13 gtjvwuyvwuyvgtjv 9 sqssqqaqqaasaas 11 rrrrrr 13 vlvlvvvlvvll 10 tsttpptwwsspttw 14 ninmnininimimmni 10 hyoyqhoiobzywqh 9 sxjgibgeojixl 5 lylwlwlw 7 yyrsvsatvaasvyrt 14 wqqqqwqwwqqwwww...
output:
1464 1 1 4097 730 6562 2 16 28562 7381 177156 785 3 591 1 1 1 1 697 16 257 73 6481 77 1 14521 1 15 1 1 145 785 1 1 15 2 257 1 137858863143 164025000064 1 183 2 11 1 1 1 1 13 1 1 24888 1 6 3003 288240100 45 3 391251 16 128 1 91 1 64 4369 15 2 3 113 3 7 16 1 1 1 13 1 16385 40 1 65537 820 1 8 14 1 17 1...
result:
ok 100000 numbers
Test #15:
score: 0
Accepted
time: 560ms
memory: 3764kb
input:
100000 13 irqnk 13 hfknacfcqcncqn 12 pasppdsdcwt 14 jdceaecccejade 13 ppjppfmttjttfm 13 ndedewndedew 13 axpbbjpba 15 ytsfxaseeae 14 hfoppnhhbf 13 npxdxdnp 14 ztvnqluxzmoucz 13 ggfxfxsssfxg 14 lslmsqquszqml 14 attfgtfa 16 uglmtlmtdugd 13 lazualviuzibbv 15 easvosovoeav 12 zmrjoomrjz 14 usufqmqsmfmm 13...
output:
1 1 1 1 98 4826810 1 1 1 170 1 183 1 1 4097 14 211 13 197 53 4 1 16 15 1 1 38613 15 35831809 1 1 211 28393 226 4097 2745 43 157 1729 1 2 14 16777217 1 16 38221 1 1 1 2985985 1 1 2 157 16 53 273 1 4826810 1 2 273 157 38221 1 211 1 13 170859376 7 1 1 371294 50851 53 1 1 1 1 1 3 98 1 13 537825 1 28393 ...
result:
ok 100000 numbers
Test #16:
score: 0
Accepted
time: 546ms
memory: 3696kb
input:
100000 15 cococcciccio 14 tqskqskqssqkkt 12 vfbvbwfbwbiiff 12 waaawwawaaaw 14 hwwwwwhhhh 15 aaaaaxxbxbax 16 otpddvhothvp 15 hhsdihddhkoxs 16 faourogfggff 15 jottjtttjtot 14 vhwuwwwvhwhwuh 14 jjqqqqjj 13 giiigiiiigig 15 hhhsssshshhhhs 13 orraoobaarbb 12 xrjbrjrbrxrb 12 kkqqkkkqqkkq 13 gfttgffgggtg 14...
output:
211 15 13 1 41371 226 17 1 1 211 15 2955 28 16 183 133 20593 183 540765 1 14 4829007 15 2745 183 1 373660 5 1048577 38613 98 1 183 1048577 1052929 7 1 98 2 2 7 50626 1015 170859376 187 35831809 4369 11 1 30583 8 2 13 250705 1 3 4826810 13 50401 15 11 4826810 65 30583 762976 1921 183 273 41371 1 2432...
result:
ok 100000 numbers
Test #17:
score: 0
Accepted
time: 566ms
memory: 3712kb
input:
100000 16 xbwbpxbwbpxbwbp 14 xdeeeexdxdxddxxx 15 ftngoxoxngft 13 ooooow 12 kotkbyktykotyobt 16 lugfwllugfwl 16 izfkfzzkkfifffi 12 iyaveivbbc 15 jeoyootteoyj 13 xkmmmrmmhxxxkmhr 15 gshgghhwbhsssgwb 14 joqdwkqwokdq 16 whdwhwhdwhwhddd 16 dsencgesdecsnpg 16 ccddccccdddcdc 13 ynyfvnnynyfv 14 jlezlwleeezj...
output:
1099512676353 3 226 1 5 16777217 273 1 16 2 16 1 5 1 113 14 15 3 1 2 815759283 371294 1 2745 157 1 1 1 2 1 1 4369 17 1 3003 1 157 23298900881764 38221 1 3 50626 32 1 1 3 77 1475789057 1 1 170 28562 65281 1885 1 1 35831809 883306230 1 11441476 1 1 3006865 2 1 1 53 1 1 1 241 62748518 65537 1 1 1 14 20...
result:
ok 100000 numbers
Test #18:
score: 0
Accepted
time: 539ms
memory: 3708kb
input:
100000 16 pssssspssssssps 12 rsssrc 12 llaaflfaffff 14 pgivzqqqqgivzpqp 14 pnpnpppnpnnnnppp 13 qqqqqqqqqqq 15 jjgjjjgjjjjjjgjg 16 qcccccqcqqqcqcc 13 haahahhhah 16 pgpggzzzppzpzgz 14 jjljlllljljljjj 16 rrorrooorrorrooo 16 hezhhezhhezh 12 tnccrcn 14 lrrrrlrrrrll 12 beojbeojbeoj 13 uzxtmyglmzgy 12 qqnn...
output:
3 1 157 1 123 149346699503 64 3 22 1 1 73014444049 4295032833 1 8865 430002433 1 1261 3003 273 399868 1 2745 665 183 1 24326193 226 187 157 1 3 273 20 7568149 157 1 1 145 85 2 1 915 2562890626 2 429981697 1 7568149 1 1 2198 273 1 1 197 1 1 197 1 13 1 10 1 2 228496 17 799736 1 255 3376 16 3 16 1 1 21...
result:
ok 100000 numbers
Test #19:
score: 0
Accepted
time: 1783ms
memory: 3688kb
input:
500000 16 rbrbrbbrrbbrrrr 13 sassssaasaasaas 3 zz 10 zzzzz 6 bibbibbiibiiibbi 10 ppppppppppppppp 2 xxmxmmxmmxxxm 12 rrrrrrrrrrrr 4 ccoc 12 pppppppppp 2 kkkkkkkkkk 10 bbbbbbbbb 8 vdd 5 ooooooooooo 15 xuxx 14 saassasaa 15 n 3 ddddddddd 7 hhh 10 yyyyyyyyyyy 2 l 5 eeeeeeeeeeeeee 10 kkktttttkktk 15 sssss...
output:
3 1 4 11111 119 111111111111111 6734 810554586205 1 5628851293 1023 111111111 1 12207031 1 1 1 9841 57 11111111111 1 1525878906 33 54241 1 1093 43 1 7 3 11 31 6 1 29524 1 1 111 1 1 273 1 469172025408063616 299593 13 4265491084507563 1 883708281 47989 1 1 14 8 31 116719860413533 597871 1 1 960800 610...
result:
ok 500000 numbers
Test #20:
score: 0
Accepted
time: 1768ms
memory: 3892kb
input:
500000 11 llbbbbblbbbllbbl 13 lbl 14 oeoeeeeoeeeooo 5 phhpphpphh 11 dtttt 5 oooooqqqooq 8 jf 8 aaaff 14 ubbubuuuububbub 15 ssssssssfffs 3 zzqzqqzq 3 nnsnnnnsn 9 kokookkok 4 ccscscccccsss 7 iimm 7 caccacaacaaa 6 xffxfxxfxffxfxxf 15 qn 10 qr 4 tftftftftfftfft 16 iffiiififiiii 6 sssbssbbb 6 ajaaaaj 5 y...
output:
2 1 15 781 1 1 1 1 1 241 40 1 1 1 8 1 435020803 1 1 1 1 1 1 6 1 1 1 1 1 1 1 1 17008 7 1 1 1 1 47909 1 1 1 1 1 1 1 1 1 1 1 5 15 1 1 2 1 1 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 1 10609328380 1 1 1 1 5 1 51 1 1 1 1 11 12291 1 1 1 1 1 1 1 1 183 1 1 197 1 1 126 1 1 1 1 1 1 1 175 1440 1 1 1 1 23 1 3595 1 22 1 266...
result:
ok 500000 numbers
Test #21:
score: 0
Accepted
time: 1889ms
memory: 3636kb
input:
500000 13 qqrqdddqdd 13 fnnfffnfccffcfc 15 dddd 4 ppppppppppppppp 12 okkkokkkkkkkoko 10 g 16 oooooooooooooooo 9 sjssjjs 7 zzzzzzzzzzzzz 15 eeew 15 qwjjjw 14 yyiyyiiyyiiyiyyi 3 nhhhhnnnhhhn 14 eneeneneeneen 9 qr 8 hh 16 uufulufullul 3 jjj 15 x 16 hhhhhh 7 m 10 jjjjjjjjjjj 14 zzpppzj 10 bbbbbbbbbbbb 1...
output:
1 1 3616 357913941 1 1 1229782938247303441 1 16148168401 1 1 17 1 1 1 9 1 13 1 1118481 1 11111111111 1 111111111111 1 22621 1 1 1 1 4594972986357216 113037178808 62748518 1 2745 1 231627523606480 183063616 1 6 1 2859599056870 4 1 10001 1 1 1 156 1 15 1 564221981491 1 2 1 13 1 15672832819 6725601 17 ...
result:
ok 500000 numbers
Test #22:
score: 0
Accepted
time: 1899ms
memory: 3784kb
input:
500000 16 clbbb 16 ilil 10 ojjv 8 pplplwpwppww 14 ehhchccece 9 bbbobbboo 11 cdddc 10 pk 14 avaavvvavava 8 eeeemmmmem 7 hzrz 5 ssosos 10 umjmmjujuju 7 wbwibwbbbiiibbiw 12 vfvvffvvvvff 3 eeggee 12 brlrbllbllrblll 15 lmnln 8 rgrggrgrrrr 5 zzqzxzzxxqzxxqqx 3 pkkkkkkppkkkkkkk 12 uuouxxoo 4 tvtvmv 16 tbtb...
output:
1 257 1 1 1 91 1 1 1 1 1 2 1 5 7 4 1 1 1 6 5 1 1 1 1 1 5 13 1 1 1 1 1 1 10 1 1 241 1 1 1 1 12 1 1 1 1 1 1 1 3 1 1 3 3 1 1 1 1 1 1 1 2 1 1 1 4 1 4 1 1 1 1 1 1 1 1 1 10 1 1 1 1 10 1 1 1 11 1 1 12 1 12 1 1 1 1 1 1 8 1 2 1 1 1 1 3 1 1 1 1 1 51 1 1 1 1 6 1 1 211 1 2 1 1 2 1 1 1 1 1 1 17 2 1 1 1 1 3 1 1 1...
result:
ok 500000 numbers
Test #23:
score: 0
Accepted
time: 1937ms
memory: 3648kb
input:
500000 6 iwciwwcw 7 gsgssslgllggss 3 txtatxxattaxt 7 mwx 15 pjppccpj 4 gybybbbbb 13 mxmxtxmm 15 ccaccffaaf 8 jdjw 4 zzzzzuquzuzqzzzu 5 ycooo 15 byebebye 14 jaamjmmajajaja 12 thtuht 10 qqjjqjqjpqp 14 drwww 7 nzfznfnzff 12 gcz 16 kns 3 xoxxpo 10 hhmwmmmhhwwh 5 ndvvvnvnd 4 wkrw 13 gzyyyzzzygzy 8 auucuu...
output:
1 1 1 1 2 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 1 1 1 1 1 1 1 1 1 1 1 11 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 13 2 2 1 1 1 12 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 15 1 1 1 1 1 1 1 1 1 4 1 1 1 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok 500000 numbers
Test #24:
score: 0
Accepted
time: 1998ms
memory: 3776kb
input:
500000 14 ff 14 feifyyifffyi 11 ppppppppppppp 8 iyiigggigiyyygy 12 hhvhvmmhhfvmhh 10 kkii 14 llflloofflffofol 13 iygiggiyiyyigyyi 16 chcococohco 15 xdddxxdxddxdxxx 16 vvvvvvvvvvvvvvvv 14 ffff 7 ookt 16 zazzzfff 5 la 16 rppppprrprr 10 ccccccc 16 ucuuyjjyjcujcyju 6 v 5 xtgdt 8 agadadaddagdaga 5 rjraar...
output:
15 1 3452271214393 1 1 11 1 2 1 1 1229782938247303441 2955 1 1 1 1 1111111 1 1 1 1 4 94036996915 1 1 19173961 400 1 1 1 1 15 1 1 1 1 1 1 72559411 328114698808274 1 1 1 1 1 1 17 1 10 94036996915 11 1 1 1 1 67546215517 72559411 1 820 628292358729 1 1 16 1 1 1 1 1 177156 1 22369621 2 3 1 1 1 1 76861433...
result:
ok 500000 numbers
Test #25:
score: -100
Time Limit Exceeded
input:
500000 7 fypiyfyiifpypyff 16 cccccczczzc 10 vh 5 rcd 8 xvvkxvvvvvkxdk 12 tutumo 15 rrrilr 10 bdh 10 tgtwtwggwtwwg 4 btbqqgtgggqgtt 12 fziiiizfiffzzz 16 dndnddeemmnmd 13 hahhaahahaaahahh 9 dydyyy 12 wjajjrjwr 15 ssspzvzpzv 13 cbbcbcbbbbccp 10 vdho 14 lffololofffql 13 wmbbwbkbmmbmkkw 5 tuuuuttuututuut...
output:
1 1 1 1 1 1 1 1 1 1 1 1 8 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 15 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 12 1 1 1 1 1 1 1 1 1 4 1 1 1 2 1 1 1 1 1 1 14 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 9 1 1 1 1 1 1 1 1 1 1 1 513 1 1 1 1 1 1 1 1 1 1 1 1 ...