QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#741934#9716. Code a Trieucup-team004AC ✓58ms31912kbC++233.0kb2024-11-13 15:30:242024-11-13 15:30:34

Judging History

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

  • [2024-11-13 15:30:34]
  • 评测
  • 测评结果:AC
  • 用时:58ms
  • 内存:31912kb
  • [2024-11-13 15:30:24]
  • 提交

answer

#include <bits/stdc++.h>

struct Node {
    int e[26];
    int val;
    int dep;
    int par;
    Node(int dep = 0, int par = -1) : e{}, val(0), dep(dep), par(par) {}
};

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int t;
    std::cin >> t;
    for (int nCase = 1; nCase <= t; ++nCase) {
        int n;
        std::cin >> n;
        
        std::vector<Node> t(1);
        
        std::vector<std::string> s(n);
        std::vector<int> val(n), pos(n);
        for (int i = 0; i < n; ++i) {
            std::cin >> s[i] >> val[i];
            
            int p = 0;
            for (auto c : s[i]) {
                if (t[p].e[c - 'a'] == 0) {
                    t[p].e[c - 'a'] = t.size();
                    t.emplace_back(t[p].dep + 1, p);
                }
                p = t[p].e[c - 'a'];
            }
            
            pos[i] = p;
        }
        
        std::vector<int> p(n);
        std::iota(p.begin(), p.end(), 0);
        std::sort(p.begin(), p.end(), [&](int i, int j) { return val[i] < val[j]; });
        
        for (int i = 0; i < n; ) {
            int j = i;
            while (j < n && val[p[i]] == val[p[j]]) ++j;
            
            int u = pos[p[i]];
            for (int k = i + 1; k < j; ++k) {
                int v = pos[p[k]];
                while (u != v) {
                    if (t[u].dep > t[v].dep) u = t[u].par;
                    else v = t[v].par;
                }
            }
            t[u].val = val[p[i]];
            
            i = j;
        }
        
        std::vector<int> f(t.size());
        
        std::function<int(int)> dfs = [&](int u) {
            int siz = t[u].val > 0;
            int lst = t[u].val;
            for (int i = 0; i < 26; ++i) {
                int v = t[u].e[i];
                if (v > 0) {
                    int x = dfs(v);
                    if (x == 0) siz += 2;
                    else if (x > 0) siz += 1;
                    if (siz >= 2 && lst > 0) f[u] = lst, lst = 0;
                    if (x > 0) {
                        if (siz == 1) lst = x;
                        else if (f[u] == 0) f[u] = x;
                        else f[v] = x;
                    }
                }
            }
            if (siz == 0) return -1;
            else if (siz == 1) return lst;
            else return 0;
        };
        int x = dfs(0);
        if (x > 0) f[0] = x;
        
        for (int i = t.size() - 1; i > 0; --i)
            if (f[i] != 0 && f[t[i].par] == 0) f[t[i].par] = -1;
        
        bool ok = true;
        for (int i = 0; i < n; ++i) {
            int u = pos[i];
            while (f[u] == 0) u = t[u].par;
            if (f[u] != val[i]) ok = false;
        }
        
        int ans = ok ? std::count_if(f.begin(), f.end(), [&](int x) { return x != 0; }) : -1;
        
        std::cout << "Case #" << nCase << ": " << ans << "\n";
    }
    
    return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3536kb

input:

6
2
aa 1
a 2
1
a 1
3
aa 1
ab 1
ac 1
2
aa 1
ac 2
3
aaa 1
ac 1
aa 3
3
aa 1
ac 1
a 3

output:

Case #1: 3
Case #2: 1
Case #3: 1
Case #4: 3
Case #5: -1
Case #6: -1

result:

ok 6 lines

Test #2:

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

input:

873
1
sgaswyo 17974065
1
s 17974065
1
naa 17974065
3
m 17974065
yimyi 864021569
m 421852697
4
sawa 613320183
auqacuy 147847601
u 58500993
aesc 461860441
1
x 613320183
3
su 613320183
g 147847601
a 750104225
3
saic 589460253
i 147847601
s 3910501
1
ioqxgke 812288287
5
a 878568205
a 147847601
c 1474279...

output:

Case #1: 1
Case #2: 1
Case #3: 1
Case #4: -1
Case #5: 4
Case #6: 1
Case #7: 3
Case #8: 3
Case #9: 1
Case #10: -1
Case #11: 3
Case #12: -1
Case #13: 4
Case #14: 1
Case #15: 1
Case #16: 1
Case #17: 1
Case #18: 1
Case #19: 1
Case #20: 1
Case #21: 1
Case #22: 2
Case #23: 1
Case #24: 1
Case #25: 1
Case #...

result:

ok 873 lines

Test #3:

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

input:

991
2
k 12116577
m 920763103
1
a 660563801
1
i 151475537
4
k 823574401
a 626796651
w 156735957
k 823574401
1
e 150470721
4
n 339617985
b 3804541
q 530778646
p 339617985
3
e 623809523
y 20799233
m 929568001
1
n 82025601
4
i 920601717
g 685069481
kyosq 543434406
c 920601717
2
n 283054937
y 71101017
1
...

output:

Case #1: 2
Case #2: 1
Case #3: 1
Case #4: 3
Case #5: 1
Case #6: 3
Case #7: 3
Case #8: 1
Case #9: 3
Case #10: 2
Case #11: 1
Case #12: 1
Case #13: 1
Case #14: 1
Case #15: 1
Case #16: 1
Case #17: 1
Case #18: 2
Case #19: 1
Case #20: 2
Case #21: 2
Case #22: 1
Case #23: 1
Case #24: 3
Case #25: 2
Case #26:...

result:

ok 991 lines

Test #4:

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

input:

685
1
w 211318801
1
i 220459489
1
m 705164161
1
eokfu 217612689
5
ocmwn 60328929
ua 602899273
z 373736741
a 695380893
s 324860389
4
u 60328929
n 946178877
n 373736741
i 695380893
1
k 60328929
2
w 60328929
w 946178877
1
oqo 60328929
1
cqmk 60328929
4
q 60328929
p 89762145
o 373736741
m 695380893
4
k ...

output:

Case #1: 1
Case #2: 1
Case #3: 1
Case #4: 1
Case #5: 5
Case #6: -1
Case #7: 1
Case #8: -1
Case #9: 1
Case #10: 1
Case #11: 4
Case #12: 4
Case #13: -1
Case #14: 1
Case #15: 2
Case #16: 1
Case #17: 1
Case #18: 1
Case #19: -1
Case #20: 1
Case #21: 2
Case #22: 1
Case #23: 1
Case #24: -1
Case #25: 1
Case...

result:

ok 685 lines

Test #5:

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

input:

897
1
eg 681843647
3
s 178308825
g 178308825
m 74248801
1
g 178308825
1
m 178308825
1
a 178308825
2
q 167261121
a 167261121
3
v 847564069
k 847564069
am 419228283
1
o 847564069
1
akwcqgigs 294962161
4
i 993912775
e 595343879
d 460421383
naoqjgac 755260694
1
y 993912775
3
aau 993912775
g 812861251
e ...

output:

Case #1: 1
Case #2: 2
Case #3: 1
Case #4: 1
Case #5: 1
Case #6: 1
Case #7: 2
Case #8: 1
Case #9: 1
Case #10: 4
Case #11: 1
Case #12: 3
Case #13: 2
Case #14: 1
Case #15: -1
Case #16: 1
Case #17: 2
Case #18: 1
Case #19: 1
Case #20: 3
Case #21: 1
Case #22: 3
Case #23: 1
Case #24: 1
Case #25: 4
Case #26...

result:

ok 897 lines

Test #6:

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

input:

559
1
r 88900522
1
ygu 66879421
1
k 270847877
5
s 27530753
u 159377961
a 774647425
o 310645065
rkcqyemn 641733643
1
afsda 374908873
1
agdap 928373101
2
m 928373101
s 854645791
4
n 922870949
s 474443881
r 922870949
y 644442845
1
bliy 709914807
5
a 927838211
q 758495081
n 14784311
g 927838211
m 641733...

output:

Case #1: 1
Case #2: 1
Case #3: 1
Case #4: 5
Case #5: 1
Case #6: 1
Case #7: 2
Case #8: 3
Case #9: 1
Case #10: 4
Case #11: 1
Case #12: 3
Case #13: -1
Case #14: 1
Case #15: 1
Case #16: 1
Case #17: 2
Case #18: 3
Case #19: 1
Case #20: 5
Case #21: 1
Case #22: 2
Case #23: 2
Case #24: 1
Case #25: 1
Case #26...

result:

ok 559 lines

Test #7:

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

input:

321
1
o 112434401
2
wmig 388490001
m 545234129
5
w 829487517
a 545234129
a 595998393
w 437327221
on 829487517
5
c 364397441
seic 900615361
eaw 847009565
y 715028169
c 364397441
1
u 364397441
2
k 841873751
w 900615361
1
a 563501251
3
u 295074951
a 900615361
a 855722385
5
rqum 151102977
s 167680337
j ...

output:

Case #1: 1
Case #2: 2
Case #3: -1
Case #4: 4
Case #5: 1
Case #6: 2
Case #7: 1
Case #8: -1
Case #9: 4
Case #10: 2
Case #11: 4
Case #12: 4
Case #13: 1
Case #14: 2
Case #15: 1
Case #16: 3
Case #17: -1
Case #18: 1
Case #19: 3
Case #20: 3
Case #21: 1
Case #22: 1
Case #23: 1
Case #24: 2
Case #25: -1
Case ...

result:

ok 321 lines

Test #8:

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

input:

733
1
u 799681241
1
b 866413025
3
m 1119473
gak 835686753
u 336657765
4
oaciy 833528233
ism 645173041
j 833528233
i 968962985
1
u 833528233
5
y 658206274
a 300952843
w 658206274
gscpgq 244876801
ge 71295921
1
e 658206274
1
eyoo 181988566
5
q 69446433
k 595359681
a 642334241
i 595359681
hiksf 4125964...

output:

Case #1: 1
Case #2: 1
Case #3: 3
Case #4: 3
Case #5: 1
Case #6: 4
Case #7: 1
Case #8: 1
Case #9: 4
Case #10: 4
Case #11: 1
Case #12: 1
Case #13: 1
Case #14: 1
Case #15: 1
Case #16: 1
Case #17: 3
Case #18: 1
Case #19: 3
Case #20: 1
Case #21: 1
Case #22: 1
Case #23: -1
Case #24: 3
Case #25: 2
Case #26...

result:

ok 733 lines

Test #9:

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

input:

641
2
s 805967761
i 408450587
1
q 961031585
2
c 696322177
l 728830681
1
saec 512099175
2
bgsea 966747473
a 273035081
5
o 869362291
guo 419728281
a 626759641
aa 670480751
g 419728281
1
n 869362291
4
g 863819637
oaaa 404305129
iuoie 27845186
a 918744699
2
afqs 253180361
kquo 460276161
1
sas 253180361
...

output:

Case #1: 2
Case #2: 1
Case #3: 2
Case #4: 1
Case #5: 2
Case #6: 4
Case #7: 1
Case #8: 4
Case #9: 2
Case #10: 1
Case #11: 1
Case #12: 1
Case #13: 2
Case #14: 3
Case #15: 2
Case #16: 1
Case #17: 1
Case #18: -1
Case #19: 1
Case #20: 2
Case #21: 1
Case #22: 1
Case #23: 4
Case #24: 3
Case #25: 1
Case #26...

result:

ok 641 lines

Test #10:

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

input:

601
3
s 179836738
yanems 369579551
m 791625449
3
c 530367501
h 98590061
y 791625449
1
l 798014893
1
a 952542137
1
d 362313905
5
k 150386689
gvxiq 263581633
n 599732224
x 599732224
w 77145625
2
x 870527872
zyaaaiqhuq 609323755
3
g 186533873
ini 615054661
o 51174657
1
a 90330913
4
ia 888868391
hm 2699...

output:

Case #1: 3
Case #2: 3
Case #3: 1
Case #4: 1
Case #5: 1
Case #6: 4
Case #7: 2
Case #8: 3
Case #9: 1
Case #10: 3
Case #11: -1
Case #12: 4
Case #13: 3
Case #14: 1
Case #15: 1
Case #16: 2
Case #17: 4
Case #18: 1
Case #19: -1
Case #20: 3
Case #21: 4
Case #22: 1
Case #23: -1
Case #24: 3
Case #25: 4
Case #...

result:

ok 601 lines

Test #11:

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

input:

313
4
sg 271816045
s 83598713
z 751870701
aagm 960700051
1
k 271816045
1
aj 267750407
2
e 223782597
m 247926099
4
wsw 862961491
kaieth 648206305
g 726362636
g 124531671
1
i 862961491
5
q 359459801
am 222661789
c 222661789
mgasm 198170917
a 254599234
1
u 425001857
1
q 624784241
5
s 260704257
q 881166...

output:

Case #1: 4
Case #2: 1
Case #3: 1
Case #4: 2
Case #5: -1
Case #6: 1
Case #7: -1
Case #8: 1
Case #9: 1
Case #10: 4
Case #11: -1
Case #12: 1
Case #13: 1
Case #14: 4
Case #15: 1
Case #16: 1
Case #17: 2
Case #18: 4
Case #19: 1
Case #20: 2
Case #21: 2
Case #22: 1
Case #23: 1
Case #24: 1
Case #25: 4
Case #...

result:

ok 313 lines

Test #12:

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

input:

5
408
psamch 412491961
wocruwkkoakeouaaawimswvyeeqsqcoacywwzamamasyaixgiyqmgmamosicmwxiqkagceoni 733236801
azgourskaemmyyoaummaocseusavfsueggaacogyaaalvagawgvmakimy 706134305
qngawqonaqyeeaanuoy 439217361
u 269794753
qaoaaukiekqageuiibmameaujyaoiuecakvmaaagjciaqwuhmsasd 614449441
sangmcnkneacaegwhmm...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #13:

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

input:

1
207
a 637227409
wcaewgkcqmauanmykgakcaeaowaqkcam 194890017
yes 431686881
tgmaaacnwuauaqxkoagaqasksgfyg 807138818
cqubkoaoiiwiaokaofk 659272001
a 637227409
a 637227409
wyjgyzawrwqsiactwqjakyheoammwnkaqcgacyaaaaknlimuakuqicmymag 591878877
wcmckqeaiwc 975170401
sagkswwai 226869026
ykamdgazsfckawumaza...

output:

Case #1: -1

result:

ok single line: 'Case #1: -1'

Test #14:

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

input:

8
29
ycoiksyzansioabasvqbkckeaeazeaqc 188581889
ouecuauwoeeyuasqmmyngo 349601281
wslysgchs 114592266
maakiaooikidu 954660097
iaaauehaaaawuhzywlcqacaagcageiomeauqgmkqpcadeiaacakeaaaukaxsejqioauosetlawkkaifiukhog 384442505
ia 436164881
kcueea 403686051
y 223718081
q 922005681
iaaciasaacqgosyckseuqsdea...

output:

Case #1: 28
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1
Case #6: -1
Case #7: -1
Case #8: -1

result:

ok 8 lines

Test #15:

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

input:

1
170
yswglyicamkgajacocwamegkc 651679067
awogw 932264401
u 361374561
haaazspacmhgkmvceoqwaooaxamunucjosyyaoqyaagcie 20671891
ncgusueeaimasixssq 409127889
aiabgoy 236231716
wokykgycwimycwkwyoymiwaagsinokbmgpaaoenwoamkmuaocdnyvqaqaiaiwesaaqaaoaysoraieayiawwuowoasieckko 766428755
mtyewqaeqekgaaastra 8...

output:

Case #1: 148

result:

ok single line: 'Case #1: 148'

Test #16:

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

input:

1
461
n 781144513
oacyreaqul 704638617
oakungiinoahuguwkywawcsisai 425452691
oqcwgcwyczeqgykyancgayoj 988168061
s 515550529
ikfmyeenaaahqyuaaqssynrkaaegguancuoarkqbgcagcqdaiysnoamw 14419409
quekunlyqeehnukdcgkzaaqgqmaumoe 719216353
a 160274449
w 790733261
w 790733261
e 174089511
ayagsoquavg 50085089...

output:

Case #1: -1

result:

ok single line: 'Case #1: -1'

Test #17:

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

input:

9
181
k 19981481
o 786836201
kegaymukg 380079521
iaoawyefsmjkvb 225488001
cueewawi 797017865
uwokiaayemkaqyulgwqwaw 282930817
sykuk 102292401
kwamxkyewcwnsnisaaieuclckaaauecyaoogyawaauzmgmwuyqekugygaigqvggnwmluwmeasqi 959747073
amainjeaanwoiqkgwzayacaw 48609893
k 19981481
eomcuaaoqiagakoeqfiaaeanuce...

output:

Case #1: 163
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1
Case #6: -1
Case #7: -1
Case #8: -1
Case #9: -1

result:

ok 9 lines

Test #18:

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

input:

1
101
aamgkxssqaa 693341053
wasakwgykekwi 702624325
vskkqwcugauoamagmafmsivus 807892260
a 265104981
r 80047147
a 265104981
qqaaakaigoagewcussfkrgmvmjbojckiwwaicgasceamyoigs 830115937
oawgsiucficqsckuacymnmeoiiakcuygukawgzbqamwcolqomasacuuqcmqyou 625409281
xuuuajanksgoesoisfacomqesskwcymseaqaaeqcwypy...

output:

Case #1: -1

result:

ok single line: 'Case #1: -1'

Test #19:

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

input:

9
461
ikinaecucn 360516501
gynaq 541388881
msakwapcwyieakyazaacawwgaaeaamecowuqaakkoxsmmfaesoppuuaa 872061313
kqcwauh 718784561
ayaoaagaeuiogoaa 195858865
wswasnyyksnwaqyoaalcagigqqgausagymieajsk 606261914
w 754526273
wmwanewa 687587061
kaawsadkagoscwycwxaigeziuamguegqwaghknsqqsgcya 19584049
kiioxwm...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1
Case #6: -1
Case #7: -1
Case #8: -1
Case #9: -1

result:

ok 9 lines

Test #20:

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

input:

3
211
q 859035301
s 879440727
awmkjga 617631150
kanaacbmmmoawqakeagupa 67070235
citpwnacmeofawuqkguymkilegaaaismaucyyamksykengkykiryaenayiwatr 380949521
uqsoro 239068536
aaywwsaqgamcs 634007009
cfi 19108257
ycempmmu 876392409
aqspmwaoataamweaqoseyecjncsoaeudyhagkquaqaigiygcaqegiuegeniu 544087167
mpw...

output:

Case #1: -1
Case #2: -1
Case #3: -1

result:

ok 3 lines

Test #21:

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

input:

5
81
iawkmwywaiajuarcemykbaiooymauywecareuaosagfaacqyemna 993651919
yacrqaaqlyuukcockgcaaqqczoakczrqzaacfso 790552017
qlygyavacikcggsgqiugmu 637983016
seyarwygmawaadaoumviiqaacsaeokxgcgenmhatqepqykgikoua 130152526
eokcsmgwwyggiknmaicjkaaqsenmefmkqsqhsacaaahabyaqmugcuecmimwtm 393032833
smozkkgqawaeam...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #22:

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

input:

8
45
uqwaacqganwoswesckoyqaomkmgiwmskuamwapaouiyakawcdahyeyuaagakqyihcqmsauiajsccksmkkguywnsaqaaurwwcoaeaeoosqcwsmgwsgaaaawswqsqmidqaskogyaoeuaagaskgamiunraceekamhskqgaaoqcwoaaaoaycemqwaamrykkyuaiasakwwgagakmqamaoyerwsxmmkksymygacwaamnaeaaacukywcomccsgaagcyskgauuwaemqxamkaomuhynnyugxunedkqaatimmcecy...

output:

Case #1: 45
Case #2: 35
Case #3: 1
Case #4: 33
Case #5: -1
Case #6: 30
Case #7: 1
Case #8: 42

result:

ok 8 lines

Test #23:

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

input:

2
41
mwaayayagwlaioaauopauaiwossnaoanqoicqsykmkwadmgmmxmqigccloeaoptwgwkewqsqoanapgnsaagwhokguspwecycuawkaqcneaoooqgiqakmmskqdugkaovgatxwuoaqomsmwuiukkkaneeoaaecnkagxqywegaejwauyiaeukahkueuoywaacdgroiqmnkqzywsauasactysbgjoqzoaawqaauaqaaosaaemeucreaosemyigcbacixcfimawaqqoewe 119386257
lamciecraqoeank...

output:

Case #1: 42
Case #2: -1

result:

ok 2 lines

Test #24:

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

input:

9
1
ucyiauacacmqgkgiyipgkawnea 972862481
41
aiymwaoxpijqqmmyogbfkqmwncymyqtywkssoewtmkcynakcgnuxmaasmamamnykkucakcioaaootozdgoeojgiqqxaaggekiqmgwieasaaaazskcmeeecmcuscaeuuamodxmugaeosatgwpsaqqeufweagmwwayuawwaopruieamuabfxesqooaomaegasyihagsoewqkgwaeashfgumugkmiksaaksawowwyaaaamcououahissgmianegmekg...

output:

Case #1: 1
Case #2: 41
Case #3: 26
Case #4: 1
Case #5: 17
Case #6: 28
Case #7: 11
Case #8: 39
Case #9: 31

result:

ok 9 lines

Test #25:

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

input:

1
16
qky 602475771
myooqacswtegowwsskaskynyaajsqgnasysapcycskgkofcseikyzwocwpkniiukaamiaazaommkqeqssoejkbaasksuemucomtgcqaozaxawwlmmkecccdckaaqwmaoaoscaauqqicmczwofaurnmmanmhaefbwqyyaigtkkwuhcpwwiefgasqaaabqgycagryqckhgmuejqkqglqiaaaayagkaakrcocaauwmsemcemyatsaiimaafoyyqoagidqcipnycriaiigslnqoaetzil...

output:

Case #1: 17

result:

ok single line: 'Case #1: 17'

Test #26:

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

input:

5
35
haqcmikuqwouqqanavvaakyzae 449436533
eaeooogssiaaoaordsgk 647726060
ywqaoeuaixfwwg 227697586
kayamijaikaaygsakeoconxmcamgqcaaqeeowaaaguqwgsoaaaaqsaveqaycuwnamiamaawjakacliqgvqaoskiiemcevmswfuaauymacyusxyoaouaogackmywugigasguqoaiaxaauaioaowiuwsqaggkgasscqscwwsijkabewwaiscccqqoawwascanwgomsgaeqag...

output:

Case #1: 35
Case #2: 19
Case #3: 1
Case #4: 1
Case #5: 7

result:

ok 5 lines

Test #27:

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

input:

5
2
wnqmkwuecuqawwakmnmqaiyiybausmucmnjeedeskafaaiqueikcqqmyemakgsaggqcoqikiqayckccacanssgaypneqmswksaayywaatjawayakacosucwwoouaomekkirgkoabuasaiokewasyujhamsriacgyeweaskcaaecukscswmiqayygapsiasaakgiumkooasocuxqaiwxaoggluggdaauyjamyzkoaaveealwaamemvoayaydiasogqswayoucyqsqwacjeumhtqkbcqnuuuyecgyoyejq...

output:

Case #1: 2
Case #2: 2
Case #3: 2
Case #4: 2
Case #5: 2

result:

ok 5 lines

Test #28:

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

input:

5
2
ofgynnaualageooajensylulkoqcnqnagkoasqwaygsyasqxygdkmsaaiwwaeyiaeyyayycsngiaqkssganacgdapcosawadwcieaetosyakacoooyuamsckaoaiyccaaeumacgmaoecwmcqmxuqilawymwkodoeqieazaqpcquqiwiacawcaygaxmwwcmeaaygmtwtwiufaodznkiysqokcaoaaaqgaamwcwkccpcetgwaachaeaqyccujafugymqkoykgucwdzquakacwacraewagwamakciwwkemm...

output:

Case #1: 2
Case #2: 2
Case #3: 2
Case #4: 2
Case #5: 3

result:

ok 5 lines

Test #29:

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

input:

5
2
kwaioaosmqhsiqqoeaerwamkazcapayeyvnawiieaojqjyfraicjamfuilcgaeekluecsqyqgkaxlwdyjwtaocwzjguaakkaaapoosnqngsagkaqejpewwmdcaimqtawymttmoayzeikwmdainycqnayuugaiaucasvaakyaiauyaeukjesgasjakomyadcemsqacoewbejwengynmuinswywkawacamgmcfyamnachwcnmaiceayawmcaailpniyyaassyweyagsikqsxiaglqfwcoaaauwsnkayyka...

output:

Case #1: 2
Case #2: 2
Case #3: 2
Case #4: 2
Case #5: 2

result:

ok 5 lines

Test #30:

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

input:

5
2
aogayaixcwcaeheyuqyzwmqiigukqaueokyqucmaaysgumumaqgwyeaaagiagsemcwsupjnaomaaeuwkoqsuaqnaawsyyxakjfemiaengkaysyywzayiyykaqwgcaaoemaxaeiuecksqimyuluaiyajoaagcqwuawsqwcyijkkujgrggcnagadgiwcquqasnwskhainsmaasgsakakyiuqamiufjwinwiaxayqevamyimgdgagqycaimousiaauscioaljquoaggmaamykejamykugxamvtdamivcumw...

output:

Case #1: 3
Case #2: 3
Case #3: 3
Case #4: 2
Case #5: 2

result:

ok 5 lines

Test #31:

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

input:

5
2
ykwwqscaiajnwshieaduyaequaoyawaiocoskosqyaajgkzywaaawkgokhyasuneicwcaweaoiaeoeqanacwaoeaycagesvnmhcknaaaekaacdwougjoewgbgmaqcoyasaakasauqokakiqyoafyqkkgkcgaadyumaqaedyggokagecieaiaqeuocmiwymqqavpsiuccowquaaogqocsieuataamvquaatynikaaepcqspcivraqaqafcoeekuyiymkincyyqasvnaalegdkmqsawoxoaggwssemgica...

output:

Case #1: 2
Case #2: 2
Case #3: 2
Case #4: 2
Case #5: 4

result:

ok 5 lines

Test #32:

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

input:

5
2
uwwagmjvqvnmemgfyqdmawcwaikifwxhqyfwmacafaiwawkamiamumgcnkaiycaiyyuxqyaagiaxgaiaawosaayuonmqjwogmgssupiccyaaimsghqbaeyyofpaklaemwokduynicgaemiwgatyaaoqayygsogkuoaegiocmocampwwnveoumccmaysakgaaupuhrsaauknkcomlywcmruztcuaawockcngayxqegnmlyikcqpsauuqcmmcigakoaaaoawpacakweaakwsimiisossexgmaagkamsnan...

output:

Case #1: 2
Case #2: 2
Case #3: 2
Case #4: 2
Case #5: 2

result:

ok 5 lines

Test #33:

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

input:

5
2
oiqwwsoctgqsvseamokosaeauiaijugouusxrgqiinwycawekcheucaswvqaaaagakuaagemaehaseasgqwmigyaakqaqaoewsqiuwacyeksbqswiiyuagogczjacaaicunaiwtakazcogguwnncurypmrkcwtcgmasajgwqsyaaavoaaovfgosohpwnomaqakgxquwyiyefhedaasumsgaasasaqakaaduyakiscaawuqgaayeeslysgcmgcnqmiqayoaogvccsngmybaxxemyoysaqqiieeoeypuno...

output:

Case #1: 2
Case #2: 2
Case #3: 2
Case #4: 2
Case #5: 2

result:

ok 5 lines

Test #34:

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

input:

5
2
xssqoiiqaaygayrqaazuiawpsykmiseeueiswsomykaelsmisakycgrcyafaiaacihaekaqmiakeaomeyawaaoeuqmkckmywawgdicautuqsjscwnqeqqskywrfkbaggsmcaycgbvissbsawfmccapyckyksnaicgaqesceounycmynqssacaaaqekcmjaaaciyyawwciqyayaasawydsamqyquwhcykggkwoymysgwcxaokkkmacyonqkksgisyysdogigusosiyuoyspiyguamlaabqacaysyayanc...

output:

Case #1: 2
Case #2: 2
Case #3: 2
Case #4: 2
Case #5: 2

result:

ok 5 lines

Test #35:

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

input:

5
2
wkkkaxnmxyamyoeioaosgiakykyeqfiqiacamkksaauaosgaiosgasakqkmagaevzcccjugkgybqieainygwemayyvwbowiecamukknhauwiiacsoixaaquugoueyaeagmiaihnxqyeedwcauaycyxyamowsuagwyagazbianqswudeawgoewooieimcyayomecoqagaiqkkycuywgajikwaabogicdlwkyxwqmouaiaaouaykwsisaaykafamdatigattaeaamsnmkaigsaenynduaaaaawaaaoaqig...

output:

Case #1: 2
Case #2: 2
Case #3: 2
Case #4: 2
Case #5: 2

result:

ok 5 lines

Test #36:

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

input:

5
2
ogaaoycraaaaqwaasmikbgyokuguqoqquawaaakayseaicaaaoqqaoemigiaygiumeyjkqgeqeegoaacmeukooaacragakecaaaswfoouocueachmtcuasaeksawagfyqyeakifkkwymmwsugwguagaymzsoyavsasaywaguaymqucokwackeawnemmaqseasieawkaecqaeavaoumlcuomwyaknswaciayfykaymorjeoanaiauayscsecunuaasqmiamiaetmszoaxiwasaqeawmvashxomqsakuuq...

output:

Case #1: 2
Case #2: 2
Case #3: 2
Case #4: 2
Case #5: 2

result:

ok 5 lines

Test #37:

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

input:

5
2
sowazqakskooicascahaausqdicyikcqaxeekyecuyaeayckiaexyuasqygaygokunjnaccaxsmtksfaaokmnoxmaqwyeaqeakmowagzsaynynyqgdskuayseelkzcaaaauqlmynnoagayaycemecaukgaayeueizlanomywaweztieqaoageyaojiaekkggesneqwpaoqaimiwioybncamqygksnhcaiammkmyacwaauqaqouckawimaoryksbaakiiweaiuafwqqsoasiiequqpsaiwemebauenamg...

output:

Case #1: 2
Case #2: 2
Case #3: 2
Case #4: 2
Case #5: 2

result:

ok 5 lines

Test #38:

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

input:

5
2
eknaaydiykacmiaaivioqqwddoieewaegyeyagsgmyoiofcwizojfiaaniaguefcqiquyayqiqamgagsemyukaykuajiieggncxmccpeeasgaacyiyducgaawgaagsqakmqabneasaagywmeaeucymaqajkcaoekmyseiakxchaoanmkuuwsogmuacattzoscmaniakushapeiuuymanoawadkuaanoerqsqaucuaycwuyymakgaizgwgneyguaseaessawaazyocosifhqiwghcigyoawunkogcwsna...

output:

Case #1: 2
Case #2: 2
Case #3: 2
Case #4: 2
Case #5: 2

result:

ok 5 lines

Test #39:

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

input:

5
2
lsaqwumaeeamzaossscauaaaesecrieaaqegaagamcgaqoemknmahgwqkntayyaeycaocwsgawgausksqomnkwseiebagstsagaykaycsakovwgooakaavccyaiakqaeqaiycamoiktgucaquuleelamquiaaseagweoatcmuyuimquyiiiueksvomurqoyxouofvsgkqgysuahisyycsenawapqaoaiiazdaqwigakkoqcwiqgykdckmwssgaewxqkuaxuooaucuccnqwaaiwwwwuyucifqzgsggoga...

output:

Case #1: 2
Case #2: 2
Case #3: 2
Case #4: 2
Case #5: 2

result:

ok 5 lines

Test #40:

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

input:

5
2
cukketsggqaeaaomuunnmcuaqjpeeuckaaoasanuwcawebvaiyssqekaakeaqcqqpyslzsonacoxockoaoakasrkgiqaemqqoscmgfskuesqjwsewakdaeawimsyggienimosakswaaiidngniaawxaqaqagaibqcccacymwjinjysemadauukwauuicamaugsuacakmameagcygakcqmwaosmsekaunazaaketaaeamcagqnqyuiqcaasiuwqynamlkwznuqiaukassjuakmasawoeoavcsoskexamm...

output:

Case #1: 2
Case #2: 2
Case #3: 2
Case #4: 2
Case #5: 2

result:

ok 5 lines

Test #41:

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

input:

5
2
yoacxywcmukccyvtuaovareqgaccgaejlgywkcifgmmaswahagakyacdkncwmhiwsazwigascqewoimyhecaawymehieyiassuaaugowmoaekqqcamsdmpkaeciymuowikianoovyaiqeryyqyafqiamqyeommmkqkmkgnuunuyyqyqnekassaagmagmacywogswiwikbargayqwaqiuaswaikewiyeiyaaaaouocausanakcpgqswwwiowmguiuichymgkojsaquaskkwckaqsewuisesavokiewaaa...

output:

Case #1: 2
Case #2: 2
Case #3: 2
Case #4: 2
Case #5: 2

result:

ok 5 lines

Test #42:

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

input:

5
100
qsckowaakigkpoawiwakfqueuysmmooinoyiwgaesambgygaocjnaja 583139451
c 213028409
seanycqsoaaeovsgabiclskaankrksawowiemcuaqfmwqfwqcaamuowgqyqyamecoqskagznawokukuomqimygskeluvoweclmemyqgwiakcylwcsjsayy 151799501
aouucigmnslawamectwgokmqckwackaaagniqaczvuusgsyagckqeuiyizeuymclqsaognggigoauesanaoudyi...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #43:

score: 0
Accepted
time: 8ms
memory: 6208kb

input:

5
100
xyeaubsaasezaazwgmnkqcyqumasokipwommsiaaqcuywniqyaarqoakoubwamqkaamccxixkanucdawinaieaswiiemawianmyursupcanagmcwkkyiemmucfrxiokoauaayoaweqqamulkqcnczawoeiasqktukaiwslakmaeqomseayqwaciunuskycaoasqacmsoysoiangoyqyaeooakakuwsgsiwnakaaobatazacaglnmayzoyyomaammiooicasukaasiaauzalkrucoiuuioeocsecggf...

output:

Case #1: 52
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #44:

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

input:

5
100
a 832781171
iauklemwkwqagaaowjiasyywqqeaaouaovyfegesgrhmqfoayahyueaayoovammmyasaomqgmuaewyokwaeamakwianoemkasusmwyyaagazocgaaoaqsxgaauguwfpdowwayqugsqkuapwycwsaaskasyecgawknsocekcabmaavagqycrnyiyaqosrssaerweuaoacgoufnyaeagsnoocramataacneymieuymsqaaausiyeqawskqmzqalsoxoykkohmsagiacujawyuiewgyyn...

output:

Case #1: 58
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #45:

score: 0
Accepted
time: 8ms
memory: 6176kb

input:

5
100
spswhaakuayoezukceiaqwacaawqaagsvajoymsgywqayuaisoekpggqfokwiojaseaeaikeonsqwuaqgoainlaisaekcqeeawxhkakykaooyaaounsmaqebewaywm 340413409
qtsaqloccqqaubmuuzuuseeduosvwaknsyaqvaikykaukaaogasvuafkuvwiaseieaazguwsadeuqmyscwdkiabeaeuawwwyasclakysaownquaswdkaawiseskcmacqsyydaqoaorbgimwcoehamakgcankq...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #46:

score: 0
Accepted
time: 8ms
memory: 6256kb

input:

5
100
mngkassfeyeckqcwuueuwogecuwwgideywuaicaeakwuoafupkskeaqqwjepiokqkmgzmgumcpmamckcqoawinmssoaqkgeiauaakusniuaqgjmesmmgaiqwaiuciuuaewcaknkqayyyaaqgqariwmaakskaguywmcmcasaaycnoswyawiyaagksoiaamajcwjqekjsgaiooexwqeouqiisoaausssayumskzkasrglcieqaaiiecquemgyyossgmquiaduyktmyimyswyusazyacocmosqaacomei...

output:

Case #1: 63
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #47:

score: 0
Accepted
time: 8ms
memory: 6312kb

input:

5
100
ajtaqwnsowiacinciuukaigmyuyegcmwaaiiwsvaucougmwylgqqwaaoascwiagnoamakukcquoecnnaoiuawuwncaajsakaaqkqalgaiigukacacgzacoumswyaqanlkatgenmogliawwaqqyaweawyqeeuakapoiammadokbqsbnwsnacaiaewieuowuewyeswiscaqexaccminwwvaiwmkaqxqgv 165479601
icawbuaamymiamunyymkwgouabeqcakeoqwoanmiagkkyqkioggekaaauqqe...

output:

Case #1: 69
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #48:

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

input:

5
100
crgilwcawavmqobkkkouwaewgmqnsalimguqawkiuijangoiiguaikaqauucauanaacsrzaqquoxoqeondsauampeyaniyemauamyowzmwgaalaovoewsicagwlmaoyowpsiomeanaeaaweaakgqkigswksqoaaacskbapenmgqusyagakfcownskfmiuciraakimqkjaykpwasvsuamscaikuaoaaookasuqeeqwyxayfbauuwokeaoaoemaedabgussamaqsiyknssisqunauenoawyyiigemqjt...

output:

Case #1: 50
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #49:

score: 0
Accepted
time: 8ms
memory: 6216kb

input:

5
100
idmiuygkc 740462851
yqakmheoiamswakmoowywkaamiscnmayo 797068721
suqogiakxyegesxkaoysyagwwkskraswcqpaseqnwqzowawnqweamcsuaysuoyoaufamtosgmiqqoiamcysqaryggecyakqyeselieqyaaaolaqmgamyskygywakugaaaqxankphysagpqaeiowcqyaealaznpiymqiauuiqeaevuiukeacqiulaaqqakhiafuakeceuauwmamwemonmmvqkemzamjtgeotmqa...

output:

Case #1: 56
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #50:

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

input:

5
100
nzqlioywwskhswaamoaaqmiwgeameaonssaummguwmgguaaaacizjgdsqaqgekmkcugggseytazbayoouvooameacsoyoaemqwscbyayawapcauaiuagncccmaagidhoiawweomcqeasawogygwmmaqgraykcaoqxwmmkarwanagqkqsqsgauwbewqynammypgaauagaagmnykyhicouajeeesciiakqpxeaiaiuwiiuwgquuiaebakcuiaaeeoeugeyejicqnkmcsalagamruwtaqaqoexaatraoc...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #51:

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

input:

5
100
mvysycaqnaugtasmyakyisbioacmqeaeqwkahgaexakaspieahaimwknwugysaekgaaaoougcwoeuncggasaaaiakawhaquycqqcaoumqoaaasasmnqgahvikeiiakslgioogmnwcayyoaawpamjmkggaswyycaapkhiec 562308641
aaewgagewaaycugivoycqovqamkykiugwmngkqim 356480433
lkevueraeqyaisggockumeqeywaewieaqiaukmmgaeyguowmwfaiaseoaumycoiikc...

output:

Case #1: 66
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #52:

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

input:

5
10000
kgy 376138001
ea 480466241
mscaoy 481262380
ir 624345869
a 526697163
eafyesac 200080867
i 612244009
wmquo 406667866
ki 859018937
s 516194811
g 795114923
i 612244009
a 526697163
n 711720131
a 526697163
k 628006337
o 22708033
t 347338163
k 628006337
zhakisw 7933401
oi 784372903
g 795114923
i 6...

output:

Case #1: 2449
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #53:

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

input:

5
10000
o 737242369
g 660523656
w 424007173
a 962245221
qoao 183498401
mysk 230388263
aaakima 190070568
u 743413157
a 962245221
a 962245221
o 737242369
h 345939401
t 934162871
ba 107740761
w 424007173
iigke 961458301
ykma 988027197
s 859645846
q 858282251
genygk 176039681
kowygx 209409585
aghq 38139...

output:

Case #1: 2441
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #54:

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

input:

5
10000
k 770125721
h 598153301
al 953925397
b 657525405
w 22287285
n 59998876
a 712163039
gco 695407301
e 550030465
h 598153301
m 264502401
q 907099001
w 22287285
k 770125721
w 22287285
e 550030465
i 336519321
onssy 953174701
a 712163039
w 22287285
n 59998876
ea 14465601
cu 157897322
m 264502401
k ...

output:

Case #1: 2469
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #55:

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

input:

5
10000
a 513366581
k 63983241
kxawcq 860667316
u 739454963
a 513366581
a 513366581
gm 677539137
i 919526017
q 528714561
w 862001601
u 739454963
y 371288931
mbawnyl 32028431
a 513366581
c 194452901
y 371288931
m 616068217
i 919526017
wqsckqa 903029079
wy 14578069
mvkak 203276571
a 513366581
i 919526...

output:

Case #1: 2438
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #56:

score: 0
Accepted
time: 8ms
memory: 5272kb

input:

5
10000
m 117970651
e 466499862
c 881624377
m 117970651
akik 341252097
a 534045665
wwemawu 155280561
c 881624377
lckiq 382640361
y 421562225
w 437418337
u 457299531
w 437418337
a 534045665
i 400646809
a 534045665
ooua 132116721
v 779705921
q 462787705
m 117970651
g 829527283
m 117970651
a 534045665
...

output:

Case #1: 2430
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #57:

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

input:

5
10000
y 39635728
a 127776201
i 665144651
a 127776201
s 261030601
b 625139211
gmohqya 954957025
kmakq 506433456
u 785355471
giaauka 203839521
sa 284373201
aa 80205301
aeea 930533657
a 127776201
u 785355471
g 251379974
t 454607766
a 127776201
p 716094521
oiz 292837941
s 261030601
q 622801513
a 12777...

output:

Case #1: 2443
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #58:

score: 0
Accepted
time: 8ms
memory: 5272kb

input:

5
10000
u 162936527
w 986913225
eheisma 172296789
i 188896001
y 421357633
u 162936527
e 209165569
y 421357633
ocom 709703201
y 421357633
a 568017025
c 674545201
u 162936527
g 238824181
i 188896001
k 550770383
i 188896001
roo 360979197
cidnaas 330010594
w 986913225
mu 213234501
a 568017025
yvewqwol 7...

output:

Case #1: 2404
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #59:

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

input:

5
10000
y 473304001
m 580237801
v 551788225
g 99843976
o 913010164
t 841091528
qkq 388590801
v 551788225
exkk 297669201
aoyhasa 256479381
eko 781454347
wiua 884896023
s 991155866
s 991155866
i 404923873
uem 668246765
k 651277097
o 913010164
k 651277097
z 505036865
o 913010164
o 913010164
ng 93960988...

output:

Case #1: 2425
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #60:

score: 0
Accepted
time: 8ms
memory: 5116kb

input:

5
10000
wjeg 973773412
a 473696453
puyea 660812931
e 115827251
s 806573623
r 896327429
s 806573623
a 473696453
a 473696453
pioqae 749907576
e 115827251
sequifm 482575477
q 656028580
u 401448216
a 473696453
s 806573623
e 115827251
u 401448216
mgkmv 87876161
w 996041411
a 473696453
y 592473341
u 40144...

output:

Case #1: 2417
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #61:

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

input:

5
10000
u 285191613
a 787129185
gik 769891479
u 285191613
kdqiedis 575023121
c 24857185
u 285191613
ea 952944921
o 791982456
e 147812876
a 787129185
s 830725361
yuwcgs 389085361
l 749938697
a 787129185
ppaadnn 830854785
g 850431281
s 830725361
y 716438791
inqauka 661816625
oao 752084241
e 147812876
...

output:

Case #1: 2401
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #62:

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

input:

5
100
ommsiwaccawgcdwykqaaaawlacucaitkscetesgqaaqaaeiircksywkue 719198499
wzoqjquhqaogegauaeriwwokcssoaetcaybacaymowoagoiokahqwiqanfvbgunamaqmyaaaawgeqcowayeguqakuvalmaeqakaefmjymsdcmqanawcykccqzoqcmecadieaiaxiigoicamyuensakullcgouoikmwuigoaeequykakbmaiaaeyykcgayamnmcagmekqcowyaimcgymiyqyyuzaieiziey...

output:

Case #1: 100
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: 100

result:

ok 5 lines

Test #63:

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

input:

5
100
diksgyyscwnueougckesauswaaayyeaizwasabtyiaaiaiqugoquumqsppcxawaazidoayqncdiwgsiqneiywjasgsicyaskwqeowaeizsitmseizkmsmiseakanrezaycwkrovayklhheyaaniqosuwxqoeummoukuembmunskeasgmvayqymqifqamyamseaaayfvkvfnocthrjaoaachuuyqaimyvwyycianaoaoiacakeakissymmemakaaqcwaqneiaakameecskwgcwenaogwwqgmgkqqmyz...

output:

Case #1: 97
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #64:

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

input:

5
100
gdywwaoomytwausaeilayckeykeismekqicabuafcawcwmaisheppsojuclbcqtcicoceikoaicaevyuwqzaeggmaaeszyaucikyamaunaaauemokwncyweqqayarxckiigmmgdwwmoyiuwbjaqsqsiaah 293945073
aeicwaiylswewmsaeuqqlwmaawwmangeuaerakuwawugnksyuvaosassoavavg 132044003
kaucyacysacmgmnskvisoquusmssgigqaciapdwoacwqieaymmwcupex...

output:

Case #1: 100
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: 104

result:

ok 5 lines

Test #65:

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

input:

5
100
aaigoksaofiquaaigaqkgyuiaqesyuaoqcaboysuqamogsweewavyooacwogwaimezamwmaayaejasouaebmemqvimmuammeseaknecwkkaamaaaeoayycmauggguquisaswycayashasqaeabayoqwaqumuiamaznzuggoasngytaypuqqwiouyaingwucqaaygasnaicbwiyacsakmcomamctcoacahdnbcaniquwewyukmiagiaaasmoqsauweronkakaksukdapgaofkewsvigwoiwsknawqak...

output:

Case #1: 99
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #66:

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

input:

5
100
soaoccqyaimmygiaaobaaacsiacaaugaymiakspgaaanuencagaghksupwckommgdowwnwsyyirkgshqaypqqcahkicywcucayksaajamlykhyaayakaisrusouanwcoaqyqknggkbaiqoaoaaogumtgakscsshaseeaxcaeeymyasiaaeeaawnegcawlfekusqqchegquqgadsqumoeuwiseeauqczcceagoswssesasuaeeieiwaekyecwidhweumaomeubwcsgwaitliseszgkaioeiucpuwaok...

output:

Case #1: 102
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #67:

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

input:

5
100
ackqgmaocqgswaaqwcakusekeacgrzaqwaiuafsacwosnagdcpmwagysbyaqykaaadiasrylskikasyqwoqwyyeumacqabgunjoauaekgwmytaqagxeuyofeaoqkwtogkscnacaogakqiqwanwaqkcaaoaacwkqogaaagkjsaeuawgaorotsuaayfaywaansopcyaefjinsqdvnsmsssaiggvaaomaymwmepaokatquikeaywqsscqonkwmawhsqwasyesokiuwfsaaciaencwwyeeqegweuygqmnu...

output:

Case #1: 98
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #68:

score: 0
Accepted
time: 8ms
memory: 10460kb

input:

5
100
ocioeayxcaagniafakhmwuaowkoqoiuuakkogsokioaguooeaolguusykqatmcwofikkmwgimawrgegayugqamwmwiooagqmmacasmaugncnsnbaqesamoqimsiuekaiaatayiqwajaiouksnonsmyrgyaeaiockaamcionqeuqmswayaaaagiaaiemgekowaqacaadgyapkoimzucanggomnpakgagusamkklk 690405319
nsduyqwaubmwssakbwamaieqaayhsgagkrqecqnptmgagqayeqmq...

output:

Case #1: 100
Case #2: 101
Case #3: -1
Case #4: -1
Case #5: 101

result:

ok 5 lines

Test #69:

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

input:

5
100
yaaookeaygwaqwkawacofkbacmuemwegmqsawecqaqeowubiekascqrkhaetasyyguqwiwwamfkassaiasagkqimayiisnswoacappwaeiocugqgmkmkqacuyfkwuoniscawsaiaoiaakiayulaelyrbjqakibhignkqmueoeaauossqseuiogaaqiqccgceboowwioayyknmkwaacysafoimcgwvamqhzawqkyusoqmouqafavjcyymaakgnyaavrhnyiothgaxaszuagaowokrunaasagaguimah...

output:

Case #1: 100
Case #2: 102
Case #3: -1
Case #4: 104
Case #5: -1

result:

ok 5 lines

Test #70:

score: 0
Accepted
time: 10ms
memory: 11048kb

input:

5
100
wslauomedguangeuawhanqyiwiebfuiayxmnisekiosmkruqswiuosnanxohagkcqueycaqaksmygukcmqipceasaavscumodiqccwawoanbanaqiqgqaieuajqasamnqgjooaoygakaxuyyqaamkwumawadcqayumacasacyyqgaeaygeqygvuoayyaimyatyuaombsgooqqqalgaugicapaayaauxkavueoyyacamqybyacgejgaesrsyaxiacieduaaeqnacawaqeaugquumongmayeaagaoeau...

output:

Case #1: 100
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #71:

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

input:

5
100
yeeoasqgekximunymkaawcxkagiqhionsewkomixgioaukrmlafwyiauckfgcesigaiqpmcncirrggacyocuwesgaawcoab 543572216
i 857861521
wsuouecnkoxokamqoiuaywisocsfawwwqlokakayaoaamqqdueskmnmoiaxcubcogariaayuswaukegkwqscvaghagagaseawcmsoeychymagsescceuoabaosmyuyarwyacogwasaageuegamkksrchwvlgwaubysmewqacoyoavctl...

output:

Case #1: 98
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #72:

score: 0
Accepted
time: 33ms
memory: 30208kb

input:

5
10000
c 944614351
guyqsuyawxajwweaahkeasaeksiktaagcuasqawdimnacsikuiumkwwvnciowapkooyyamqiaaksnwqsijaeshqgqaayqcqaonauuunoakqqeeayekeavaaanqoewmwaaoioygclbalmraaaisgkqajuoymfwyanowmqwugveckcuesheuiwcaggiackuaacmqomgcqegxhuoneiwigpymgykwcyygosyozscseawouonqayiioccdaoaquigwummaazwyiqqococwfmaqseeogo...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #73:

score: 0
Accepted
time: 42ms
memory: 30360kb

input:

5
10000
calimgyoaxeiauxajsaeonsbgceiainmaonfaaowiacayoaeaaqaaqoeqhuptietgaqsaigcayesywhkauygaeomaxozkgaiagxykyntqaaykeuswakegososaaewaeugiuaauhosugbamaecgqmmewzhaggamawcgiokamwcaoinypecaouqwaseeeosiojsbynyqqqwgmgyiakjeawqiwmeeumsaiuaymmcaiswoaoawaiqgaivsmqkemiqyaoqaqigneaiiqbzaikkyskammaqawgawcawaov...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #74:

score: 0
Accepted
time: 41ms
memory: 30732kb

input:

5
10000
aeqavaqekgegkvehteseauqhagyuuaeagonmsgepaowywsigqaaztisssnyszsyseyoeyugiegauaaueyqwykewgaekiayiaiysbozrianmamspskqosigyhzuqnkgalwbkclknmacqwuwmngiisqpawayeaoemydoyggkgcsifoiawscsaacsociioasaaiukingeahgogiiimiwieweamakuobgusayuqoouaakqcisqmioeycpbiscingaaaccqasscaagyqwimmqayikcnagagqkqesaxwws...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #75:

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

input:

5
10000
qekggkskwvawgimigmomgcykawqaaumsnfgcujwascuuaquikqagdnassycaaauoajqalgaooqkicoawruakyuyaamjkeacyueocnguocqpiuiaewkmyaaaxqqhuwvqddoyscgoqa 338295383
aauisbassekiweekvraiaeiaoywewaaabyauormrabcisqqwnaaeaaaquqkesvycrcqqmyfkyiasmkibmusqkeaqyuqanuheawsmeciguuaewmaycsazeagumwuphqaaquyaanqkkkaekama...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #76:

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

input:

5
10000
ciyywqqnanmyzaqkajqgawarasmbyaooaaiggagzsdgmnbsaaameamsgakavaswiyhqaaeaefuayuiayoqusiqmslwwomcywsaoaieqbgaqxwyiaiylyhgmavwaammonaiiirniueuasuqecxwkfwesakoayqsiwxtceqmkggoaikupaoakcdyemyasyxaogapqikqaamyakieabwkpngcaaanqikelmxigcuuaammawaauaceoqqcckzoqogkeaaoacuzmeyyuscpewejmuojwymsaiapawavgw...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #77:

score: 0
Accepted
time: 39ms
memory: 29172kb

input:

5
10000
e 150659273
qggioywamgsim 139689001
p 856995625
cmguoqaaauacwcqcym 338029021
iinizfqfkn 255114401
i 801670401
mcskgodwauuosrnqmkc 151155201
saqymoaannaoiqq 737253751
cmtnsmauogcm 752152801
eqkkm 229537024
aoseym 904959687
aqoyaycaegwgsuswaq 511427513
oaugkxag 754550221
a 387869153
uvqemuaxgo...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #78:

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

input:

5
10000
mggmqfm 903831681
g 646169601
msqpagkpqom 549296881
kufqavciwskouweanwm 283713153
c 964358147
qibsgmauawauoayoqaaaa 291633601
k 672799593
aeckmnyasbleawsq 23537721
ewigaiabca 838594433
qoa 253654837
w 953521313
t 784983501
sgamomyuceekdyawegnokqw 516312501
kueius 863724477
agkom 216317781
as...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #79:

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

input:

5
10000
ce 375568321
kyvaaaw 675014915
a 508413483
uuao 994611565
seawukqiumxuokuaw 880259841
aaqwcgumaqat 427848449
eareyomvg 62743048
eoswqnuaaezsw 573602081
qegeethchab 617382763
xqsmgarda 446802285
ejqqcsauqerswamqepe 514285057
a 508413483
aaowzncuiviaoqs 526141381
aeabqq 743287201
mkgt 24013440...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #80:

score: 0
Accepted
time: 34ms
memory: 28612kb

input:

5
10000
i 931332751
mgwknqwuqieawgi 900489017
c 900246081
k 675950597
haanmskamkasakg 198742761
cnldgwkgyqaqikkmcwq 700222463
y 554500347
qoukyacoaqmyinkzbomcmfn 450413571
samgg 988352041
s 914141021
kksaaamcgaeaaxq 609405441
uambcuymakeaqaqaama 344648901
kgm 336312561
cwgucciowskoavuasa 167145601
u...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #81:

score: 0
Accepted
time: 49ms
memory: 29440kb

input:

5
10000
gywnkksmq 618721753
zcy 934105626
k 563282053
s 422719691
u 894196955
egycsmjbsyicyoguaaekhaai 655976891
yqnokqnwgauahyceaqassqi 674806435
gqwcozaamm 916435102
i 301685411
acceieakoatucayecka 819127199
uia 67748801
yqcexaauigysyeayoqnaooas 143896641
g 643030273
eomyuemtymlcmealy 86373281
y 2...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #82:

score: 0
Accepted
time: 49ms
memory: 31324kb

input:

5
10000
a 825061743
wugasegntakhwma 857313521
wwoumsa 755783261
isisoawkneaacgtn 200187825
s 351451395
sgagoqyyacaek 871974781
aawmyo 422797569
n 526083436
kicauuaaqkeoqaigaak 736863513
egeaoqonwiauxmcia 492051329
skobowaa 191093653
o 830815191
eoiqsaaaaaqm 19717633
d 569002461
goegw 222097337
nkavx...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #83:

score: 0
Accepted
time: 53ms
memory: 27912kb

input:

5
10000
w 473579165
ysqwha 605030981
wwuvoamtgsyaaeuuiou 22649411
gtosqjmqwva 639383942
tyo 300146049
a 799344914
vaosopnakawomacaaoyym 360360141
gggwaoukmsaai 433775121
ayjowilwamcmu 900643686
e 536116657
kkuw 532823725
cxocdsesae 634643143
aaqoqaaqgafiwwniko 169799169
qsoiwmawqwipa 453976161
iwwyu...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #84:

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

input:

5
10000
o 553875201
laqojaatnrivaac 449638017
aqu 236387161
i 524764241
scuqerciqoalsywsa 159062815
yoqw 10751369
immayyekxymk 42695233
sogacycaiowmsagkslnaoumnf 910939841
cmnis 321157746
imeeilncna 717015886
a 916755553
aeeekyymiaoeeom 144715684
anwaeycmmo 36817487
an 272428405
oeyaoowyssu 95281893...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #85:

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

input:

5
10000
qsc 805342401
uuiieceseqaaawaa 921137861
au 192505201
a 758038401
saaqafiagaacqyikuiymcsama 741322129
egasfaazmq 577500601
a 758038401
e 778874553
ya 320922201
qageuwsayfmraaiyaxakacaokikzugskgc 272806203
y 708146274
ouspjkmgueia 128910813
sodnmsaia 537217145
sngwkquoysgiaeotg 468201025
o 88...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #86:

score: 0
Accepted
time: 46ms
memory: 28616kb

input:

5
10000
gaamagaaq 792279313
a 708260341
ekaewoybyaauk 834024721
yoguic 354489971
iigszsea 801468945
yvqyfuqgoauuizapya 395155701
ea 181698817
yetsaaxemebaq 151031913
a 708260341
aqbaasa 314774681
roswwomainowdwwkasyaecgrqqqka 848420881
ekwwasae 415872024
a 708260341
e 275432057
a 708260341
kuaugalct...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #87:

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

input:

5
10000
iaumvaain 883812305
cygkwwesagx 757501281
nwaiy 88566357
maai 110933121
pkacugewauaclie 304056751
akyooqsacagwav 777193807
a 141434369
i 148099373
o 228067901
pkmgeuoqegmkqeimhajcwssaagahgvkgaauwalw 870062041
saawcika 860015457
s 409691641
ankaguaaes 732369705
o 228067901
o 228067901
aaccgma...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #88:

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

input:

5
10000
y 40844617
uugicc 276349761
kyku 650108105
iaykvgcqwqysaolginuwcki 329581956
ywaompfgae 571153825
b 539061861
asowoiccaai 422725001
kuqaaxm 55380337
agsmcalquawqkiyw 369588525
aoeaewacuagunkamxog 406726241
a 909302242
u 502996409
aptiessccaaaa 728674435
q 39820625
o 407856301
ksyieylagmaikiu...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #89:

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

input:

5
10000
gqaaiid 602060795
v 16870741
eqa 611722405
qaeaaaug 6346207
ys 517755281
esgouqkgnkgtk 408048417
ksqcnjosapwgmyacyucehaskek 840609896
ncgqmuaatcwcsagmooi 803072525
c 638620661
zga 206903881
g 638065809
munucooyaeasyktsgdfos 689866913
akgcaaqpsyeaicaosuiinim 313658566
opwg 389350697
wgacymiug...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #90:

score: 0
Accepted
time: 53ms
memory: 27640kb

input:

5
10000
o 588051201
uks 523698251
gyuecnsmoaesuqkra 818614593
a 157544241
auomameyvcaqqta 331033217
oeaammsoaaekume 141650001
eiiukyy 947154337
wuxaegwagyiepaaceym 136108661
a 157544241
cmai 221734081
tktooaym 973583201
mcwgorayie 232012569
qwgacgukaiaqsaiazanocqa 74312001
y 99667041
gkavjapaeamsaak...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #91:

score: 0
Accepted
time: 35ms
memory: 28312kb

input:

5
10000
a 355874001
aqg 178683426
gicaqyakvwguwabuhaasykqaq 41196221
ny 801124289
nsawyicaoeumouiy 103911197
tioaii 701749164
zsuqe 303155561
wqaetkeaweygpug 277823105
e 488518901
cgumuaoqyekuuaosu 152038081
ynyiaracakqysioma 915416593
e 488518901
asaiagyaskmoi 380296251
bccusnwyyqywfkxw 136313731
s...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #92:

score: 0
Accepted
time: 39ms
memory: 28136kb

input:

5
10000
ggawc 979965505
qsqgkoo 971249345
o 691341441
aaayhqummceaizamwkn 961481801
cu 676723119
gyawpawedwsgqasscjmaevq 563907151
k 562461103
aucoiqukm 1368951
quwy 601537713
esaqqyiemmieyehnawv 540495297
oacakncwiktaa 664184161
pzwascs 825191317
amsdglgickgsoaaua 315888372
ze 379017641
h 934692521...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #93:

score: 0
Accepted
time: 36ms
memory: 27784kb

input:

5
10000
qaaaejaoe 688264249
mceyniwtmn 50617683
ksebs 130670485
i 695539637
eclsxawnawnobakewcuwum 606337073
gwwneigowgiu 560929821
cifewv 142700526
skcayqnesx 98335569
o 865543709
i 695539637
yanagkmmqnrqjesseswaeuiswsyo 367653845
kanajg 951761181
wlsaocaimsayqns 609310397
qv 45441365
o 865543709
a...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #94:

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

input:

5
10000
i 45174382
g 761657729
wmetpcommwasubcce 814785060
ieqesa 493883905
wcxdsaqio 809282761
ume 10446586
ychazooayaekmksbensc 206767041
o 829550176
iamwagkrguacyckwg 306985301
efaocwbecwaswycosa 145009097
gmkwew 265163137
c 417092193
uusygjcuiuaqtkwumiy 474987693
brwwmmnkveucsuos 424740153
qsuak...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #95:

score: 0
Accepted
time: 35ms
memory: 29096kb

input:

5
10000
gymmawk 676107737
rsyayuqaeia 949087361
y 74974557
nuqonuawggaqoucgg 89790701
k 747144681
asyegaeoqqia 115210727
eskgakamja 49728691
bqayoaaaamaue 830979983
saounasaema 27386761
k 747144681
asncpwligaakoggeusgchcw 311636391
clzgsqmc 709451005
foxodpmnkwk 101248001
wgycesaoajxwfg 930264688
c ...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #96:

score: 0
Accepted
time: 45ms
memory: 29044kb

input:

5
10000
a 113396281
unsm 212198333
wqgaumlpvacamuvaosyhi 149200711
m 629384427
l 994750529
mcnesaqcatesxmqehqeyw 438641832
ceoemyw 803388807
n 823769296
facmoiwawmsmimqsazkzckoae 821391616
kewhskq 187811001
kwqq 893110401
gkqieeil 55204821
ogtiqgick 185446097
kziyaaeqwcakuygmwhpsm 372544257
ambawoac...

output:

Case #1: -1
Case #2: -1
Case #3: -1
Case #4: -1
Case #5: -1

result:

ok 5 lines

Test #97:

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

input:

5
100
eugcqwmaveamyiyxazuollgwitaoncsaknaoiqiwayaeiamusqeoyyaoeonneaxeammoeesmemtakcsggaucuaocqyggaaaikvmukiabaaaohacsawmwjgawaausisscqcaaskksykqwsagwcoaqsnagmeoienateqhkoumketqiwewcaayqeyaygwaaaqlaaksqurdsfacesacmaesuzwgqwnmkywgvgswsyqaasdecgudkoyayimiiawgayaklkwaagniyohsukcknktaqiqeaxvcyeynuzagksa...

output:

Case #1: 100
Case #2: 100
Case #3: 101
Case #4: 100
Case #5: 100

result:

ok 5 lines

Test #98:

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

input:

5
100
kquayqicqmhksonicuwahawaskkesqwkvneuekaiwaqmikmssaecoleuakseoymimqlgqtwkyiqamjgoeiaueasgywimbcgzqoatssabagymamoyarueemaywueasdbyaakuqxcayyuaogywkackatcigdsyoqwaowiugxcacoywesikzuayeimagakaqassqaeakwmvgqkagawnmseggrymchagfamaiaaawecuwymuiaoaawqiamouauaaeqgisygqcqigkyseaqiafiemagaoalqeuocygekziy...

output:

Case #1: 100
Case #2: 103
Case #3: 103
Case #4: 102
Case #5: 102

result:

ok 5 lines

Test #99:

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

input:

5
100
ksegieaymdqcgfneaafowsoqgswkcgafawyzuaaamacqqjaasehsgaicqoygiuaskzmaiyeyymrieiduwqaciakwqngbclfeuaaovaiaoweaiquyawkqigckeaqoqukwygoeienrkciakaawkaoaoaemakkaggnmaxeoyysyeamiusuixfuauaakuqkuqawiipmkyooaqaujsicasgucqmqrkenskbfuikgcauamaqbaacaerdgemiqbeahmiaiaomatayamoaiesaagsawqkaluleuaawguyaisqg...

output:

Case #1: 100
Case #2: 100
Case #3: 101
Case #4: 101
Case #5: 101

result:

ok 5 lines

Test #100:

score: 0
Accepted
time: 49ms
memory: 30412kb

input:

5
100
g 885699181
tgqawwalhjniiowamuusikyywaukmaamukawemugzicagogggqtoyrgawwkcosvyqqiamassmgiukwkmcgscwlcaqlhjackeuemeiaasrwkogegmeawgiayciyaaefawykacmawqaqaomanysecrogsaqgekucsumcmykawwagwqssolasucoxsmagmikgeiwlagsydigcucanuegoacaokecdscqmwmhsqaosiyuakngqfaoynamwwqaowagokaiaimfwrwasgyacyosayiaaaais...

output:

Case #1: 100
Case #2: 100
Case #3: -1
Case #4: 100
Case #5: 100

result:

ok 5 lines

Test #101:

score: 0
Accepted
time: 42ms
memory: 30424kb

input:

5
100
socuijaigalmccumdfxaahogmtsyuqqoqwaqayqoqaaqcaauawwlwqueyaanecmgefmkekkcayiowoyiyuaaaceksmmneeomikyqmykmacoageiqancamqamgbfugqycbaiyscgacrsieyseqfiuaaaumeakqcawhskaaayggqmszyyvskooswmfsaimsgwaoaoiamcqguqeakssghgyuaaatesjwqunejucxtmsuoowqauavsjucawcaykieosgrkrscyyaotwaaooaumykeggoogannoaiceosao...

output:

Case #1: 101
Case #2: 101
Case #3: 102
Case #4: 100
Case #5: 100

result:

ok 5 lines

Test #102:

score: 0
Accepted
time: 41ms
memory: 31832kb

input:

5
100
wonmayocsnawaniaguawaaaysljgwwnwawqmkujgaeoawmyaacmmmaiwwmsayuzayssuaakspywiamkewoumgiadugycqeakwagmelfwaaaeyaazaymheikcoaiaefkagogayayeagnawwausyyiyotxmytemniswnieqquyswymacykqkweeycvwewagyjaajcqznoixqwseemosimaakaawmokkaksaofqaoaqjaqpiqsqswuzgsvaasaaaialmaaakauukaioerumagpeaishwavgvacymixqwz...

output:

Case #1: 101
Case #2: 102
Case #3: 100
Case #4: 100
Case #5: 100

result:

ok 5 lines

Test #103:

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

input:

5
100
amaaaafgmameelkirgkacotoaiywaqumarcpaaheuoeumwnygaxqdqiwowcmayirnqamutyamyccggqcam 790132661
qjqcsfoaacsaeamwaciouikasmoaamkfusqqusaauahyzaaacecagthahaaeraqeqfakwaaaisuuerbaaiuyagwzgaqccqfuacbooaalyeqqwqoaqcmeagvoeanmrayeeanuzqwaauyljaeaokwetmkmskyisaizyycqikioypaweayekkcavsueraooagawqgjeiaaga...

output:

Case #1: 100
Case #2: 100
Case #3: -1
Case #4: 102
Case #5: 100

result:

ok 5 lines

Test #104:

score: 0
Accepted
time: 40ms
memory: 29960kb

input:

5
100
eiwueaqaaoyksysnsimmsgkeoaagwrimskmicoonwammeuiswkcgwaknaqgkmiomdkqiaskaalbakwanmyiosakiuswadgioaaiqoauwaadwealyqjkkogicaaahacomkaslacsokgiauyjimipsomacyaaagqgsaaiuuaawnvasucyaggqsqgaebpaaoqanimegewiuswegxigawwakpacausuwesgueeoayimaaokuymaiyagaagqogcaeaaycaafecigargkguieedoouasucoewjualxpyaawl...

output:

Case #1: 100
Case #2: 106
Case #3: 103
Case #4: -1
Case #5: 102

result:

ok 5 lines

Test #105:

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

input:

5
100
ecyuooujiqgyscagacgyicqswcvvgsqacywacpuxikspzyaeaoasgewakwgcuwgquygaaaycgmegsujifaeagsymcznswoaoqcaeqnsaigaaeceknaioccaaqaoagqamyoyuicavaeuqzcacuaasakadyupaoiuyuuacweweaqaaaglbaickuxyngwacaakopucaucyymaskkyemcaatmguagcatsqminmykkodykkyuiawycsgiaecsorkamkweyakmsgaoaocsnbycoiaisxoqoixyokwkakarao...

output:

Case #1: 100
Case #2: 101
Case #3: 100
Case #4: 100
Case #5: 100

result:

ok 5 lines

Test #106:

score: 0
Accepted
time: 36ms
memory: 31472kb

input:

5
100
mumeyjxkaymeoqghwsggdgmwsswquwnrxwaaaquoxanaiuyklyasclkqmmgvmypqipyvqageasqqikwoeeukoskwacaysyeeagsbwuakqaacryukapaagaumqwckpognwikwuksuyssvvatryaiawawkiaauguoqovmkaaquicewqmasqgskaaaasaazaaosfqmwimmccaqqwhcwmgkqiibekcqiauwkiaihoymkcokyycuicraccqcaixaeeyoswbykgmqaoqqkmyamjwaawjacuvgacckyuuayag...

output:

Case #1: 100
Case #2: 102
Case #3: 100
Case #4: 103
Case #5: 100

result:

ok 5 lines

Test #107:

score: 0
Accepted
time: 55ms
memory: 31380kb

input:

5
100
iqwobseenkhzcaeaccicniggyogawotiaaosyiywsaqeccuikssqkaciocslqnuwiknarigaqatmkcgac 725679114
aasgscyvqipasueqcjsamiaykcwsaaiqiaonqaaaasyqqqimengackymqmaaacwigaaaqstaakpakaoqqcxawkquagecoaccmaaanywybaseeymsfmcjkaymsoqnanaykneoemweumtkmaqknuwuuawaamoosaeyccaqrwhaanabzencmecmeaagaygkieawaqmymuxaac...

output:

Case #1: 100
Case #2: 101
Case #3: 102
Case #4: 102
Case #5: 101

result:

ok 5 lines

Test #108:

score: 0
Accepted
time: 49ms
memory: 30536kb

input:

5
100
heeoaqrirwiynyasyaaanmqoacqgwbakoukggaauyaamuugkmeifcasecduwcamaaoycsaqkquzzhoohwaskguaasuawuwxcaslafakceeaiwqeweownamownacyoygmeqeuissucwsgokwiuusmeaacuwaqealqqqacoiifmrfywwiawiiaazawkaasoiyouyqwmcuyacwwgkggiqawearkgeoygmgkaocwnswqkgeeraaaakowsacyciwfsdqxqesmoagauwanqevpsazzuugacuqaaugskelkav...

output:

Case #1: 104
Case #2: 102
Case #3: 102
Case #4: 101
Case #5: 101

result:

ok 5 lines

Test #109:

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

input:

5
100
aeukcwaaeyogwasatiwaiihanarakeyhbwqmneawiaasqqouosyaiawyuaqeaancnmbeeggyqasaaeaaiwaveeqcysuwoongsaiousguvkkonmuoysyuepsuulcawntaycrawhssnaqmqseaoeewwykmkkicsaayeaaqtkkwoaweoamkgoeakaqieaaawoiiqjwwyoagxymgckkumsxeokutsgahjasalmmaiaiokaksaeilmnaaacoahioaysayqaouyaukcaellsusacugaomkqaksawokoaucaq...

output:

Case #1: 102
Case #2: 101
Case #3: 101
Case #4: 101
Case #5: 102

result:

ok 5 lines

Test #110:

score: 0
Accepted
time: 39ms
memory: 30580kb

input:

5
100
yqokwauckaskumcsuxycwoegfmmaiumsguoouywyswccvaywkkokmvoiapmmiauaaeausyyhmaooeqkaouwwsqkiaecasikgmiykkwkqgogoxsmeguyuasqkmnaoaosectmgkauiuwmuftouaamqkycaqqqajimsgrotknaaaumkxoisugayyaoekxaqngiiamxeqammimunsaykaksawyuqnefaygaquiyeowiayaaauaqnwaasacwfdwyiaayacngwyysiacacqaqwahogofsoaieumgmafacaaa...

output:

Case #1: 101
Case #2: 100
Case #3: 101
Case #4: 101
Case #5: 100

result:

ok 5 lines

Test #111:

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

input:

5
100
qiqwcagmaskaseewyqeiqgqwnaalaobsysgnyqmyuqiqqkbfgdakwckyyiamqaggkyyoccjawucgyiuqwwuucqaoyoaawgusakaawaigjdauezkqgagrigcgupcaawaeeanuzasaiiysawavviawswgcqwsnsiqaqakkoekwyiwouibptyayobaiwqawwcbiqkuawawaemayanzkunwoaknuqicausagaqgsemaieoccuyseaacsygyaguyarqkagapggeqllacaxqisyokaaewocaqkakwqwicura...

output:

Case #1: 100
Case #2: 101
Case #3: 103
Case #4: 100
Case #5: 103

result:

ok 5 lines

Test #112:

score: 0
Accepted
time: 41ms
memory: 31456kb

input:

5
100
igmglqanomafninauycmnvgojegayagcinckoaakauacujcqqanaqjyssuaoqeasnecaikgdkmalawauaggmyieaqniyaysaccowisqscsmiwgyaahuiiqqevcswkeaasigaawkwcpkeoauqaqsyekkeqmkyqaaumqwsylikksnieqteasqafsiseaagslckhoucwgoytakegsdefndkeakscaksqagwogeacogasaaqioicagmygkaayamyifacayccwsaayyokazwankkssqwuwayuwgaeciyuuy...

output:

Case #1: 104
Case #2: 101
Case #3: 103
Case #4: 100
Case #5: 101

result:

ok 5 lines

Test #113:

score: 0
Accepted
time: 39ms
memory: 31912kb

input:

5
100
awigaayyuatgqanacawcyouktgcyaawissaspug 869921601
fafeelaakmoyosaawawaoisituacasiiioegwyegiraqgkcgpeaodmmisekmyahagihawmqmicynimaaaaaimgekbomaauqasyfqrafgmimaziqcoiswcawsegecfoqgwagaiuyapaysjeefmkmacesouqabygeimkcmquwqazaokaglaikemiqoaocoaemommeosafyqqagawccamugiavspgouaqcionujesywyaivawsgunac...

output:

Case #1: 101
Case #2: 103
Case #3: 100
Case #4: 104
Case #5: 101

result:

ok 5 lines

Test #114:

score: 0
Accepted
time: 25ms
memory: 30596kb

input:

5
100
aoqmeeeqwqauoyqxieoisaugmeaqsvwlamkbamaeisysmaeayppnckauanosguqjwjackqgeqvseaszaacsbakjmmkkamaauewweciiaqwmxsagxgcuaokmawiyccuwdaqugomjnauwqdiweuiyuonmwcakkhcaugowikymasccaonacakqyogqawyuakkewsacsgaoaaeoaaakpkmkiwqigiicylhgieawykluusnyimdayqaeavnwcpmferuoknqqmcgoxeuaeaaiavyiiqxvwccsdjotcagmgcw...

output:

Case #1: 100
Case #2: 100
Case #3: 100
Case #4: 100
Case #5: 102

result:

ok 5 lines

Test #115:

score: 0
Accepted
time: 35ms
memory: 3568kb

input:

5000
10
kms 1325425
a 206925809
gwayeaafucwsa 785911644
qaeqknimak 133885593
avauzsyeaw 929003621
kbocnhniaa 797635249
muoasgavauamusda 404703605
uauniyacsebpuu 908943802
egcyoaiqa 976208506
y 370072833
10
m 22618687
qcwknioeasg 304561633
kasw 712578385
v 356154281
ywqgkyacsktafcayiacmaqoyc 52818547...

output:

Case #1: 10
Case #2: 10
Case #3: 10
Case #4: 10
Case #5: -1
Case #6: 10
Case #7: 10
Case #8: 10
Case #9: 10
Case #10: 10
Case #11: -1
Case #12: 10
Case #13: 10
Case #14: 10
Case #15: 11
Case #16: -1
Case #17: 10
Case #18: 10
Case #19: 10
Case #20: 10
Case #21: 10
Case #22: 10
Case #23: 10
Case #24: ...

result:

ok 5000 lines

Test #116:

score: 0
Accepted
time: 35ms
memory: 3576kb

input:

5000
10
gaoryqs 834807041
wibugsbq 697816476
ugnw 991704893
nekeqclwmaiauwut 203094929
egcg 403461297
mzkm 189955921
euqaquavakuqgcmfauw 262424881
sbaasoakuoc 679119861
wqack 45317081
sdeno 546001801
10
aasqnqi 108180211
egwa 522814747
aomwc 568502381
y 15403461
acaypaaam 736531021
wagsubiscriagumkq...

output:

Case #1: 10
Case #2: 10
Case #3: 10
Case #4: 10
Case #5: 10
Case #6: -1
Case #7: -1
Case #8: -1
Case #9: 10
Case #10: 10
Case #11: 10
Case #12: -1
Case #13: -1
Case #14: -1
Case #15: 10
Case #16: -1
Case #17: 10
Case #18: 9
Case #19: 10
Case #20: 10
Case #21: 10
Case #22: 10
Case #23: -1
Case #24: 1...

result:

ok 5000 lines

Test #117:

score: 0
Accepted
time: 36ms
memory: 3792kb

input:

5000
10
yon 277972337
ow 696487265
pxvy 377580501
anaogtekgliheoamuoum 653422117
wmqq 651727481
t 967719131
myyacyn 170956438
kananykquynxomayoarcqqawac 844322601
iaiisoaklwaaagaaw 715412393
jaua 227260555
10
g 390532865
q 437709369
iomaacqucwmskokcet 129865301
agaieiiwo 903879681
iyagaasqwyacyiaa 3...

output:

Case #1: 10
Case #2: 10
Case #3: 10
Case #4: 10
Case #5: -1
Case #6: 10
Case #7: 10
Case #8: -1
Case #9: 10
Case #10: 10
Case #11: 10
Case #12: 10
Case #13: -1
Case #14: -1
Case #15: 10
Case #16: 10
Case #17: -1
Case #18: -1
Case #19: 9
Case #20: -1
Case #21: -1
Case #22: 10
Case #23: -1
Case #24: 1...

result:

ok 5000 lines

Test #118:

score: 0
Accepted
time: 35ms
memory: 3640kb

input:

5000
10
kmelreank 873303769
kwsyaq 13558774
sgumjkeeug 371308001
iaymocsagj 716736834
c 933255649
m 303944216
y 791152101
qgasapu 78193801
ygiaywjzokpsaikyuiueswjogc 142302101
iugngqgymmsaytqqkeam 188254417
10
aqkpz 168237801
uenw 849106117
gfaszpesiommauqa 73041991
v 167902601
c 675926269
aauowfwic...

output:

Case #1: 10
Case #2: 10
Case #3: -1
Case #4: 10
Case #5: -1
Case #6: 10
Case #7: 10
Case #8: 10
Case #9: 10
Case #10: 10
Case #11: 10
Case #12: 10
Case #13: 10
Case #14: 11
Case #15: 10
Case #16: 10
Case #17: -1
Case #18: 10
Case #19: 10
Case #20: 10
Case #21: 10
Case #22: 10
Case #23: 10
Case #24: ...

result:

ok 5000 lines

Test #119:

score: 0
Accepted
time: 35ms
memory: 3796kb

input:

5000
10
e 958033345
ekgwsksmcoamcugeywk 432399376
a 220660641
ygavk 33940771
egyeqgamosamcuq 374233751
vyaekmaoaaakgxf 572574621
c 893955841
s 277563176
mkcqiocvgcwiksaea 641745816
pykonamwcscaiw 302696091
10
layuman 775989281
c 248664001
oiyaiqroixuswmwau 936935201
wcku 881431313
aoocyyonaapanyqygm...

output:

Case #1: 10
Case #2: 10
Case #3: 10
Case #4: 10
Case #5: 10
Case #6: -1
Case #7: 10
Case #8: -1
Case #9: 10
Case #10: 10
Case #11: 10
Case #12: 10
Case #13: 10
Case #14: 10
Case #15: 10
Case #16: 10
Case #17: 10
Case #18: 10
Case #19: -1
Case #20: 10
Case #21: 10
Case #22: 10
Case #23: -1
Case #24: ...

result:

ok 5000 lines

Test #120:

score: 0
Accepted
time: 36ms
memory: 3824kb

input:

5000
10
ugeytacyk 528819585
h 453226103
assuq 604867913
caaiku 210913166
auammwavkeaa 255439657
kdmyqgxaaamawyaaqgcncsma 2762501
cgngcwaoaagn 741815361
quy 771930001
tygheaake 737431761
cmauiacuveamgqgacmi 994598831
10
eigaa 607228225
u 995561269
geqkgacda 280732745
i 44035387
iyomscaaumyodeaqsewsoo...

output:

Case #1: 10
Case #2: 10
Case #3: 10
Case #4: -1
Case #5: 10
Case #6: 10
Case #7: 10
Case #8: -1
Case #9: 10
Case #10: 10
Case #11: 10
Case #12: 10
Case #13: -1
Case #14: 10
Case #15: 10
Case #16: -1
Case #17: 10
Case #18: 9
Case #19: -1
Case #20: 9
Case #21: -1
Case #22: -1
Case #23: -1
Case #24: -1...

result:

ok 5000 lines

Test #121:

score: 0
Accepted
time: 35ms
memory: 3856kb

input:

5000
10
ribai 477315257
qqfqsaauym 990379495
q 942841057
e 699267131
aaybayaeityksakiaaggcugkusbdtywnk 605086721
iaig 463847681
aausqcosw 951094741
swaegikoqmcin 50175037
o 934925051
awwvwmaqgikqa 540908801
10
amqseen 689818955
eweaecua 937512501
yccmksa 632798881
gqwycaaceowqesdhm 798596809
ni 5928...

output:

Case #1: 10
Case #2: 10
Case #3: 10
Case #4: 10
Case #5: -1
Case #6: 10
Case #7: 10
Case #8: 10
Case #9: 10
Case #10: 11
Case #11: 10
Case #12: 10
Case #13: -1
Case #14: 10
Case #15: 10
Case #16: 10
Case #17: 10
Case #18: -1
Case #19: 9
Case #20: 10
Case #21: -1
Case #22: -1
Case #23: -1
Case #24: -...

result:

ok 5000 lines

Extra Test:

score: 0
Extra Test Passed