QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#792363#9159. 登山Shui_Dream5 910ms164244kbC++233.3kb2024-11-29 09:33:312024-11-29 09:33:31

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 5
Accepted
time: 1ms
memory: 7968kb

input:

1
4
6
1 1 1 0
1 1 1 0
3 1 2 1
3 2 2 0
4 2 3 1
6
1 1 1 0
2 1 2 0
2 1 2 0
1 1 1 0
4 1 2 2
6
1 1 1 0
1 1 1 0
3 1 2 1
4 2 2 0
3 1 1 0
6
1 1 1 0
1 1 1 0
3 1 1 0
4 2 3 1
2 1 2 0

output:

1 4 2 1 5 
3 4 4 1 0 
1 2 1 2 2 
2 2 5 3 3 

result:

ok 20 numbers

Pretest #2:

score: 0
Wrong Answer
time: 0ms
memory: 8124kb

input:

2
4
300
1 1 1 0
2 1 2 1
3 1 3 1
1 1 1 0
3 1 3 0
4 2 2 3
7 1 2 0
8 2 2 2
7 1 3 4
7 3 4 4
11 1 6 1
12 1 3 5
10 2 5 5
13 1 5 4
13 4 7 2
15 8 8 8
16 8 9 4
15 1 9 6
18 4 5 6
19 3 8 8
18 5 10 2
19 3 7 5
23 5 7 6
22 6 8 10
23 4 7 3
24 1 4 6
24 8 12 9
28 7 11 8
26 1 9 7
28 1 3 1
29 2 5 0
32 1 6 4
30 5 12 7
...

output:

19 18 35 1 38 15 -721420200 0 0 15 349 261 0 -1509948895 195 0 108 -1509948930 0 0 103 -1652555051 -1652555290 0 855638904 0 -1509949042 -1509948795 174 -1065350239 -830465561 411045068 139 276826106 276825321 276826038 37 -1509949155 276825321 -964685708 19 0 -1509949209 0 19 -1769995030 679516863 ...

result:

wrong answer 7th numbers differ - expected: '50', found: '-721420200'

Pretest #3:

score: 0
Wrong Answer
time: 2ms
memory: 8184kb

input:

3
4
300
1 1 1 0
2 1 2 1
3 3 3 0
2 1 2 1
3 1 3 1
3 1 3 0
4 1 4 1
6 4 4 2
9 3 5 1
7 3 4 2
10 2 5 4
12 1 5 2
11 1 3 2
12 3 6 6
13 6 6 3
13 3 8 0
14 3 5 0
16 3 5 5
16 6 9 5
20 2 7 3
20 3 7 9
21 7 9 2
23 3 4 8
21 4 9 6
24 11 12 2
25 3 4 1
27 7 13 5
26 1 8 3
29 2 4 6
29 6 15 14
29 5 5 10
32 6 10 11
30 1 9...

output:

20 18 40 1 233 80 39 212 229 41 190 -234875870 486539342 0 -234876817 713 118 0 -234876835 -234875840 0 -234877651 -234878114 -511704120 905992210 -1652540420 903 905992172 -234878153 1 0 0 -234878153 -1618827548 -1300149265 92345259 -192927720 -1937742164 -125758146 -234877750 0 0 -1233035029 25170...

result:

wrong answer 12th numbers differ - expected: '5094', found: '-234875870'

Pretest #4:

score: 0
Wrong Answer
time: 18ms
memory: 15052kb

input:

4
4
5000
1 1 1 0
1 1 1 0
1 1 1 0
4 1 2 0
5 2 3 2
5 1 3 1
6 2 3 2
6 2 3 1
8 3 5 4
8 4 5 3
11 2 4 4
11 1 3 3
11 5 6 3
12 1 1 6
15 1 5 3
15 1 6 6
17 5 6 5
17 6 8 4
18 7 9 3
19 1 10 3
19 2 4 7
20 1 9 3
23 8 11 7
22 2 5 4
23 7 8 1
24 1 9 8
26 9 11 7
28 8 10 13
29 1 11 3
30 9 9 14
31 11 15 4
32 8 16 8
31 ...

output:

1 1 28 83 25 29 108 111 1 79 21 0 29 21 134217973 133 -981466462 381 -1795160719 345 0 -1795160834 318767594 310378840 -1795161523 -679477003 -1115684599 20 -1954541437 384 -855634182 -855634498 -50328936 0 -754965593 134219267 -754965593 -981462440 134219051 134219051 402682307 28 738235707 28 8137...

result:

wrong answer 15th numbers differ - expected: '133', found: '134217973'

Pretest #5:

score: 0
Wrong Answer
time: 26ms
memory: 11784kb

input:

5
4
5000
1 1 1 0
1 1 1 0
1 1 1 0
2 1 2 0
3 1 1 1
4 1 1 0
6 1 3 2
7 1 3 1
8 2 2 0
8 1 3 2
11 3 5 1
10 1 5 4
13 1 2 4
12 3 4 3
15 3 5 2
15 2 6 2
15 1 3 3
16 7 7 3
19 1 7 4
18 2 3 4
20 1 10 5
21 2 3 8
21 4 9 6
22 7 9 3
24 2 6 8
25 1 3 4
25 3 4 1
26 3 4 3
29 5 11 9
28 8 11 12
29 7 9 11
32 5 12 5
32 11 1...

output:

2 35 2 3 34 5 34 3 578814022 277 578814501 1 0 578814431 -1719663152 380 134 -1719663497 578815058 134 578814713 0 134 578814332 64 0 5143 234882663 69 0 29 159385093 1695 0 159385246 0 0 159385210 0 209722336 318769702 104 578814055 725 897582464 159384958 -830454964 50335189 0 -1476374002 -1031785...

result:

wrong answer 9th numbers differ - expected: '35', found: '578814022'

Pretest #6:

score: 0
Wrong Answer
time: 705ms
memory: 131232kb

input:

6
4
100000
1 1 1 0
2 1 1 0
3 1 1 0
4 2 2 0
5 1 1 0
6 2 2 0
7 6 6 0
8 3 3 0
9 6 6 0
10 8 8 0
11 6 6 0
12 12 12 0
13 11 11 0
14 2 2 0
15 2 2 0
16 2 2 0
17 9 9 0
18 1 1 0
19 4 4 0
20 18 18 0
21 13 13 0
22 20 20 0
23 3 3 0
24 21 21 0
25 8 8 0
26 11 11 0
27 11 11 0
28 3 3 0
29 21 21 0
30 1 1 0
31 27 27 0...

output:

7 90 394265928 -352308106 -545056710 -1348348408 -1844544566 42788089 -1325540990 -375091338 544053826 60127929 661407218 265188638 -254974593 -657699965 -1296876370 -1228418451 505084810 505770587 -1135541041 971259923 588316659 -81870278 -949626934 -1703181922 219358674 690978640 35886695 -1910626...

result:

wrong answer 3rd numbers differ - expected: '1343', found: '394265928'

Pretest #7:

score: 0
Wrong Answer
time: 728ms
memory: 153648kb

input:

7
4
100000
1 1 1 0
1 1 1 0
1 1 1 0
3 1 1 0
1 1 1 0
3 1 1 0
7 1 1 0
6 1 1 0
9 2 2 0
6 1 1 0
6 1 1 0
7 2 2 0
9 2 2 0
11 1 1 0
11 2 2 0
14 4 4 0
12 1 1 0
16 3 3 0
15 1 1 0
17 3 3 0
20 5 5 0
18 4 4 0
20 2 2 0
19 2 2 0
22 5 5 0
22 2 2 0
22 3 3 0
23 5 5 0
27 7 7 0
26 6 6 0
27 5 5 0
31 1 1 0
33 9 9 0
34 2 ...

output:

1 1 1 1 31 2 2 94 31 1298 33 1 126 41443 62 880803966 880803906 520095119 521585676 880803965 32375238 2 520136469 520095088 158251579 43479120 520136469 1 1 656526137 880805169 724876005 -269249417 -255152834 -255152833 -1323013433 880805169 -621533406 1 649226454 584894907 348911218 549509337 4041...

result:

wrong answer 16th numbers differ - expected: '95', found: '880803966'

Pretest #8:

score: 0
Wrong Answer
time: 708ms
memory: 150648kb

input:

8
4
100000
1 1 1 0
2 2 2 0
3 3 3 0
4 4 4 2
5 2 2 1
6 6 6 0
7 2 2 0
8 7 7 3
9 4 4 3
10 1 1 4
11 3 3 0
12 8 8 11
13 13 13 7
14 5 5 10
15 8 8 11
16 14 14 5
17 9 9 2
18 17 17 7
19 3 3 1
20 1 1 9
21 14 14 5
22 5 5 17
23 8 8 14
24 8 8 9
25 24 24 7
26 24 24 7
27 17 17 8
28 27 27 27
29 26 26 6
30 17 17 14
3...

output:

12 23 22 21 578814029 134217902 134217901 19 134217889 7 452985361 7 77 76 76 -444595626 -444595649 -444595668 -704640476 -444595680 -444595680 41 41 -117439781 -117439781 -25165092 -117439816 6 -780139179 -780139201 41 679488150 562039959 562039959 41 578814048 578814048 578814048 520096853 1426088...

result:

wrong answer 5th numbers differ - expected: '42', found: '578814029'

Pretest #9:

score: 0
Wrong Answer
time: 733ms
memory: 155420kb

input:

9
4
100000
1 1 1 0
2 2 2 0
2 1 1 1
2 2 2 1
1 1 1 0
6 1 1 1
3 1 1 0
6 1 1 0
7 1 1 2
6 2 2 0
8 3 3 2
9 1 1 1
9 1 1 0
12 5 5 2
14 1 1 3
13 4 4 3
13 1 1 3
14 3 3 3
17 5 5 2
19 1 1 0
18 3 3 3
22 3 3 5
23 1 1 0
21 5 5 3
22 4 4 4
23 7 7 2
24 6 6 3
25 2 2 1
29 6 6 7
29 8 8 3
31 8 8 7
32 6 6 5
31 5 5 7
31 2 ...

output:

4 6 0 1 23 0 11 44 0 1 5 3 -1811939242 1 0 2 1 18 1 595591541 1 1 -1954545522 202 0 1 -1811939260 -1317010732 0 179 23 595591339 0 -872413607 0 0 155 155 0 -1811939043 0 763364530 -1317010911 0 192942265 -1124069214 23 -1149238311 662700845 -327152283 645923055 0 687869898 0 645922992 40 645922969 6...

result:

wrong answer 13th numbers differ - expected: '62', found: '-1811939242'

Pretest #10:

score: 0
Wrong Answer
time: 790ms
memory: 132048kb

input:

10
4
100000
1 1 1 0
2 2 2 0
3 3 3 0
4 2 2 0
5 2 4 0
6 1 3 0
7 2 4 0
8 3 8 0
9 1 6 0
10 4 6 0
11 2 9 0
12 2 3 0
13 1 13 0
14 4 12 0
15 1 9 0
16 7 13 0
17 10 17 0
18 17 17 0
19 10 11 0
20 2 13 0
21 9 11 0
22 15 18 0
23 9 22 0
24 4 6 0
25 21 22 0
26 9 16 0
27 18 27 0
28 4 16 0
29 13 24 0
30 1 5 0
31 5 ...

output:

27 1160 -1115611756 -1730665137 323874945 689440818 757333090 872290591 639049887 227849008 218276551 -115435407 287022497 -878716740 -963034286 -1429015013 -1195482176 53473772 -382430312 485089628 653902871 453282519 -56444343 504544821 90122315 -1159963822 -441413497 615109941 905500397 916091611...

result:

wrong answer 3rd numbers differ - expected: '73079', found: '-1115611756'

Pretest #11:

score: 0
Wrong Answer
time: 876ms
memory: 160664kb

input:

11
4
100000
1 1 1 0
1 1 1 0
2 1 2 0
1 1 1 0
2 1 2 0
6 1 3 0
5 1 2 0
7 2 3 0
6 2 2 0
8 1 3 0
9 2 3 0
9 3 5 0
10 2 4 0
13 2 4 0
12 4 6 0
13 1 6 0
16 1 4 0
18 6 7 0
18 2 4 0
20 1 6 0
21 2 9 0
20 1 3 0
23 1 4 0
22 1 8 0
24 10 10 0
23 3 5 0
24 3 11 0
26 8 11 0
27 1 9 0
30 2 11 0
28 12 12 0
32 4 8 0
32 9 ...

output:

41 1 42 3 3401 -24757786 8 316944319 3484 12 -990122188 -439026781 3443 -731220200 209860141 -146836805 -795628251 3442 612069207 -1033429653 903253842 830644720 -1041318778 179660210 292190016 -655294616 278506544 292189975 -1017727846 501963341 39570167 -689601591 90863383 125286645 509505708 2388...

result:

wrong answer 6th numbers differ - expected: '407995', found: '-24757786'

Pretest #12:

score: 0
Wrong Answer
time: 905ms
memory: 163000kb

input:

12
4
100000
1 1 1 0
1 1 1 0
3 1 2 0
3 1 2 0
4 1 1 0
4 1 3 0
6 2 4 0
7 2 4 0
9 1 4 0
8 1 3 0
11 3 3 0
11 5 6 0
12 1 2 0
14 3 3 0
13 2 7 0
16 2 3 0
17 2 4 0
17 7 9 0
17 3 8 0
20 2 6 0
21 10 11 0
21 6 11 0
21 7 9 0
23 3 4 0
24 5 11 0
26 6 9 0
26 5 7 0
27 12 13 0
29 10 10 0
28 1 3 0
31 13 15 0
32 7 13 0...

output:

1 44 3430 45 -1325036617 10424 -924013139 17373 31271 -392643616 556357630 75412278 575477427 411763413 -379497993 942453840 107677698 3475 -1729317627 -1804919993 45 219116587 -1766506304 562327894 -1463774827 469112939 -908764772 411766887 411763413 -866159083 688171102 453433541 311891025 1143693...

result:

wrong answer 5th numbers differ - expected: '363401', found: '-1325036617'

Pretest #13:

score: 0
Wrong Answer
time: 733ms
memory: 149236kb

input:

13
4
100000
1 1 1 0
2 1 2 0
3 2 2 2
4 2 4 1
5 1 2 4
6 4 6 2
7 1 6 4
8 6 6 5
9 5 8 8
10 6 6 1
11 8 11 5
12 8 11 1
13 4 8 6
14 4 7 1
15 11 15 5
16 1 1 10
17 6 9 7
18 8 16 2
19 2 9 10
20 6 20 7
21 12 14 11
22 9 14 14
23 6 7 22
24 12 14 11
25 20 20 21
26 10 20 0
27 19 26 8
28 21 23 12
29 4 13 23
30 15 2...

output:

28 55 26 109 25 -1115684589 -1115684673 -1115684756 24 -1115683674 -1115683783 67110108 67109890 -587199802 -1115684136 -1115684355 -536867576 -687862171 -1702885769 -1568664480 -1652554914 21 21 92279338 298 -1023399089 -411040079 -360709247 189 189 83887759 83887783 603999385 511734851 134218674 1...

result:

wrong answer 6th numbers differ - expected: '246', found: '-1115684589'

Pretest #14:

score: 0
Wrong Answer
time: 830ms
memory: 156280kb

input:

14
4
100000
1 1 1 0
2 1 1 1
1 1 1 0
2 1 2 1
4 2 2 1
5 2 2 1
7 1 4 1
8 2 5 3
8 5 5 3
10 2 3 5
11 1 6 5
10 1 4 5
12 5 8 1
12 3 6 5
13 3 6 2
15 2 5 8
17 6 7 6
18 6 8 5
17 10 10 1
18 4 5 5
20 4 11 7
22 8 9 4
23 9 13 12
24 9 13 10
24 6 8 7
26 3 13 13
26 11 14 11
28 11 11 2
27 9 16 8
30 6 12 0
31 13 17 16...

output:

38 0 2 37 1 150 149 39 34 33 109 0 226 276824172 374 32 -1442840200 -1442840167 -1442840093 0 -1442840094 -1442840171 30 225 260047886 371 225 679477657 -763360319 369100661 255 -444594571 551 -1166014571 -1166015821 0 -905966197 -905966197 352340693 536871603 -1778374283 -1166014658 -1166014983 -88...

result:

wrong answer 14th numbers differ - expected: '69', found: '276824172'

Pretest #15:

score: 0
Wrong Answer
time: 816ms
memory: 160968kb

input:

15
4
100000
1 1 1 0
1 1 1 0
3 1 1 1
3 2 2 0
4 1 2 0
5 1 1 2
2 1 2 0
3 1 2 0
7 3 3 1
9 3 3 1
8 1 2 1
10 1 5 1
8 2 3 0
9 1 2 1
11 3 3 3
14 1 2 2
15 1 3 1
15 2 4 0
15 1 4 3
17 3 4 2
19 5 5 2
21 4 6 4
21 6 6 2
24 2 4 6
24 3 7 4
22 3 4 0
23 1 5 5
23 5 6 6
26 2 8 3
30 5 9 8
27 4 6 1
27 3 7 2
31 6 8 7
32 5...

output:

8 69 0 2 69 1 63 1791 141 1 8 73 46 1720 0 37 1860 159444305 1 226 159442444 9 146 0 145 637789118 0 0 156 1 -1979634552 478325190 394264648 -1979638132 -1979645293 318831437 318877304 620880217 3581 -1115512191 -1988096515 0 0 -1115517422 159427768 135646430 3580 915059775 109305658 620880217 15944...

result:

wrong answer 18th numbers differ - expected: '60684', found: '159444305'

Pretest #16:

score: 0
Wrong Answer
time: 844ms
memory: 162408kb

input:

16
4
100000
1 1 1 0
1 1 1 0
1 1 1 0
4 1 1 1
1 1 1 0
2 1 2 0
7 2 3 2
3 2 2 0
6 2 2 0
8 2 3 0
11 1 5 1
11 2 5 3
11 3 3 4
14 2 6 2
14 2 3 0
12 2 3 0
12 4 5 0
16 3 7 1
19 3 7 2
18 3 4 2
21 2 4 0
22 1 3 0
21 1 6 6
21 4 5 3
21 1 7 4
23 1 10 2
26 1 6 4
23 9 10 0
25 7 8 1
25 3 9 2
27 9 11 3
29 4 11 7
33 2 6...

output:

55 2 1 0 2 109 53 1 1 2332 503318754 56 2 218 503324130 503319029 13499 5101 2551 503329979 394346761 285358937 0 5359 503316914 8420594 503319029 274 424 503334803 165 218 377505682 0 260 0 0 511736908 956826459 43 -360431551 0 -1048055677 0 -1358675412 42 562297006 0 83942310 -318594258 8426514 57...

result:

wrong answer 11th numbers differ - expected: '2110', found: '503318754'

Pretest #17:

score: 0
Wrong Answer
time: 841ms
memory: 160936kb

input:

17
4
100000
1 1 1 0
2 2 2 0
1 1 1 0
1 1 1 0
5 1 2 1
5 1 2 1
6 2 2 2
7 1 1 0
8 1 1 3
8 3 4 2
6 1 3 2
9 2 4 1
8 4 4 0
11 1 4 2
10 3 3 1
11 2 5 0
14 2 3 0
17 4 4 2
14 3 4 4
17 1 4 2
19 2 6 6
17 1 1 5
18 1 5 3
23 3 7 2
22 2 3 7
24 4 6 3
23 1 7 4
23 7 7 5
27 5 6 2
26 6 9 5
28 1 7 4
30 1 9 5
29 2 6 6
29 4...

output:

2 1 1 54 51 2 49 -931135374 0 209 1 57 67109388 105 -931135382 -931135082 67109387 -931135381 0 -931135333 1 44 67109287 364 1 67109329 211 852 -931135178 155 154 155 54 444601674 154 0 444601398 -2013263365 -1652544688 -989851771 67110530 -931134248 106 525 -1769993925 251664180 54 0 154 -211392408...

result:

wrong answer 8th numbers differ - expected: '59', found: '-931135374'

Pretest #18:

score: 0
Wrong Answer
time: 837ms
memory: 162152kb

input:

18
4
100000
1 1 1 0
2 1 2 1
2 1 2 0
2 1 2 0
3 3 3 1
5 1 3 1
4 2 3 2
7 1 3 1
8 2 4 0
9 1 4 1
8 2 3 3
12 2 5 3
9 2 3 2
11 1 1 1
11 2 4 1
14 1 6 2
15 7 7 0
17 2 4 4
18 6 7 1
17 2 6 6
17 5 5 1
20 2 5 7
22 1 7 3
23 6 10 7
25 4 4 6
25 8 11 7
26 2 10 3
26 6 7 6
27 12 12 2
28 1 1 0
29 8 11 11
32 3 9 12
30 2...

output:

60 2 64 1193 1 1132 3 10615 125 6733 1 61 763368282 2023 763376329 763369353 2023 0 2022 0 763377582 769 13000 5541 13586 763368101 763389130 -1216327780 763383063 687937355 646 646 0 763383062 0 -452851100 763387108 763425865 -486401912 964692305 0 -33528630 61 763431873 -293534556 763410117 1254 2...

result:

wrong answer 13th numbers differ - expected: '4893', found: '763368282'

Pretest #19:

score: 0
Wrong Answer
time: 836ms
memory: 163912kb

input:

19
4
100000
1 1 1 0
1 1 1 0
2 1 1 1
4 1 3 1
1 1 1 0
6 2 2 1
5 2 2 1
6 1 1 0
5 2 3 1
9 1 3 0
10 1 5 3
11 2 4 1
10 2 5 2
13 1 2 2
15 1 3 0
16 1 3 1
16 3 4 6
14 6 6 0
18 6 6 1
19 1 7 2
21 6 6 4
20 9 9 3
21 1 4 5
22 4 8 7
24 2 9 8
26 7 8 0
25 1 2 8
28 1 9 8
26 2 5 3
30 2 2 1
27 9 9 3
30 4 9 2
29 3 7 8
3...

output:

38 1 37 873 5 1 276824140 18 982 49 39 25 868 1 -1954545465 -142606237 1 2647 696254488 2646 712 1 3 675 3 276825050 637 859 889225122 956309409 276824140 -1577028429 -1442834440 151 -830461217 -855616232 41998892 -1577037223 -855626413 -1543397901 495099939 8803 13540 495089824 -1400818782 10891 90...

result:

wrong answer 7th numbers differ - expected: '37', found: '276824140'

Pretest #20:

score: 0
Wrong Answer
time: 827ms
memory: 163236kb

input:

20
4
100000
1 1 1 0
2 1 1 0
3 1 3 2
4 4 4 1
5 1 5 0
6 1 6 3
4 2 2 1
3 3 3 2
8 1 1 3
7 2 5 0
10 1 3 4
11 1 7 5
9 1 1 3
14 1 3 1
12 4 6 4
16 1 4 7
15 2 4 4
17 2 7 1
19 6 9 6
18 4 6 2
18 2 7 4
18 2 4 3
22 1 7 0
19 3 9 6
20 4 7 7
26 5 10 9
27 2 7 10
27 3 10 6
29 8 9 10
26 7 8 5
31 3 9 1
31 5 13 5
32 10 ...

output:

52 103 49 369099375 -1560279792 -1929379372 200 2 97 176163047 97 155 1 262 200 45 157 369101797 369100847 157 311 109052061 888 204 369100643 369098907 0 109052848 0 -1149233945 -780134353 -201322774 52 109052405 -956298268 155 -201323483 -587197224 -1434435699 612379730 -1518336642 369098907 41 -1...

result:

wrong answer 4th numbers differ - expected: '571', found: '369099375'


Final Tests

Test #1:

score: 5
Accepted
time: 1ms
memory: 8084kb

input:

1
4
6
1 1 1 0
2 1 2 0
3 2 3 0
3 2 2 2
5 4 4 3
6
1 1 1 0
1 1 1 0
3 1 1 1
3 1 1 0
4 2 3 1
6
1 1 1 0
2 1 2 1
2 1 2 0
2 2 2 0
2 1 2 0
6
1 1 1 0
2 1 1 1
1 1 1 0
4 1 2 1
5 1 2 2

output:

4 11 5 1 1 
1 2 1 2 3 
5 1 6 1 6 
1 0 2 1 0 

result:

ok 20 numbers

Test #2:

score: 0
Wrong Answer
time: 2ms
memory: 8176kb

input:

2
4
300
1 1 1 0
2 1 1 0
1 1 1 0
4 1 2 1
2 2 2 0
6 1 2 1
3 1 3 0
4 1 2 1
6 1 1 1
10 2 3 0
6 2 3 2
11 2 4 0
11 4 5 2
14 4 4 5
10 1 3 2
12 3 4 0
12 2 4 1
15 7 7 5
17 3 4 1
16 4 4 0
21 2 2 5
20 2 4 2
20 2 2 1
23 3 5 1
20 3 4 0
22 4 5 0
26 5 7 1
28 1 8 1
27 2 6 6
26 1 5 2
30 1 3 6
28 1 1 4
28 2 7 6
34 2 ...

output:

34 69 3 1 236 34 104 1 173 749 28 443 36 1 69 2124 271 1 2089 35 1 578814515 125831541 578816375 7628 444 4976 12140 35 578816375 271 0 193 298 1 444 1 388 0 0 260071426 -1711258722 2423 89 260059286 578814223 4511 -1216313910 0 0 -58719957 17308 -1342159971 20 290 0 -58719957 201396022 578838232 -6...

result:

wrong answer 22nd numbers differ - expected: '528', found: '578814515'

Test #3:

score: 0
Wrong Answer
time: 0ms
memory: 10128kb

input:

3
4
300
1 1 1 0
2 1 2 0
3 1 3 0
4 1 3 2
4 1 4 2
3 1 2 0
5 1 5 0
4 1 2 3
4 1 4 3
5 1 2 2
8 5 6 3
10 1 3 2
9 4 5 3
13 4 6 1
10 1 4 3
12 4 5 5
13 1 2 1
13 2 3 4
18 6 7 6
17 6 8 3
19 1 3 3
21 9 9 4
22 2 4 5
21 5 7 4
22 1 5 1
23 3 9 3
24 1 1 6
25 1 2 7
28 1 8 6
30 1 11 2
30 4 9 0
32 2 10 3
30 6 8 8
32 6 ...

output:

25 249 447 129 26 274 929 1 16 0 78 1288 26 275 25 52 -822082845 763 1 184551353 3700 851 3253 184550227 -360707355 1857 3253 0 6382 19019 -822062769 184559118 823 -822078948 -822080795 9277 585 8365 -1568578355 142646528 2789 274 274 22165 -1568585135 0 -1568604512 0 2789 830804540 0 -679431835 125...

result:

wrong answer 17th numbers differ - expected: '17', found: '-822082845'

Test #4:

score: 0
Wrong Answer
time: 26ms
memory: 15780kb

input:

4
4
5000
1 1 1 0
2 1 2 1
1 1 1 0
4 1 1 0
1 1 1 0
3 2 3 2
6 1 2 1
5 1 2 0
8 3 3 1
10 1 3 2
8 2 2 0
11 1 5 4
11 3 5 3
13 4 5 3
12 3 3 1
16 1 5 1
13 4 5 5
18 1 5 5
17 1 6 5
17 1 5 4
20 5 7 4
19 1 1 7
23 1 8 3
23 4 6 4
23 8 9 7
24 3 4 2
27 3 6 3
28 5 8 9
26 1 4 4
27 3 10 8
28 8 11 9
31 4 6 3
31 10 10 2
...

output:

3 2 1 2 41 1 40 3 118 117 207 34 42 81 166 332 33 33 2 41 82 33 -1384116541 251658557 42 109055815 -1409285563 0 0 2957 -25165660 -1803550270 251664660 -25163439 -1023410094 -25163807 251664620 -1023409759 -1728036391 -1711234620 0 -1149215935 -771728039 -25164466 251664084 0 -1149223380 -1409281324...

result:

wrong answer 23rd numbers differ - expected: '3462', found: '-1384116541'

Test #5:

score: 0
Wrong Answer
time: 22ms
memory: 15272kb

input:

5
4
5000
1 1 1 0
2 2 2 1
3 1 2 2
1 1 1 0
3 1 1 0
4 2 2 3
5 1 1 1
8 3 3 1
8 2 3 2
6 4 4 3
10 2 4 2
10 2 4 2
12 4 5 3
11 2 3 4
11 5 5 1
14 1 3 5
16 1 1 2
15 1 3 0
17 1 4 2
18 3 7 3
21 5 8 6
18 6 7 2
22 1 5 5
24 4 7 4
21 5 7 7
24 2 9 0
26 9 9 2
24 5 9 9
29 8 11 2
30 3 7 4
30 8 9 6
31 5 10 6
30 3 5 4
34...

output:

34 33 0 6 578814052 0 5 1 4 32 14 7 7 0 578814252 0 578814251 -260046648 -905969634 578814216 95 35 -679476888 -679476749 1 318768259 1 26 813701402 956305796 260048045 -1442837153 159385862 578814119 117443203 679478902 226493572 24 796919655 159384050 24 -1275058239 645923614 0 24 570427552 -45298...

result:

wrong answer 5th numbers differ - expected: '65', found: '578814052'

Test #6:

score: 0
Wrong Answer
time: 709ms
memory: 130412kb

input:

6
4
100000
1 1 1 0
2 2 2 0
3 2 2 0
4 2 2 0
5 3 3 0
6 3 3 0
7 6 6 0
8 3 3 0
9 5 5 0
10 2 2 0
11 4 4 0
12 6 6 0
13 8 8 0
14 6 6 0
15 2 2 0
16 2 2 0
17 17 17 0
18 5 5 0
19 15 15 0
20 2 2 0
21 14 14 0
22 17 17 0
23 10 10 0
24 23 23 0
25 10 10 0
26 17 17 0
27 23 23 0
28 21 21 0
29 29 29 0
30 7 7 0
31 21 ...

output:

13 116 92275860 922758587 -628992105 580502267 -1878943429 179272742 245958077 -445254478 -382054890 -721436240 -2057024891 -504149739 182326671 388277029 701920057 -1076025720 -542255394 161866924 234349446 530915224 -1527550270 478424403 457601777 -1274081528 115327041 186520584 28616089 546648263...

result:

wrong answer 3rd numbers differ - expected: '1159', found: '92275860'

Test #7:

score: 0
Wrong Answer
time: 733ms
memory: 151076kb

input:

7
4
100000
1 1 1 0
1 1 1 0
1 1 1 0
1 1 1 0
5 2 2 0
5 2 2 0
7 1 1 0
8 1 1 0
6 1 1 0
7 3 3 0
9 3 3 0
12 2 2 0
10 2 2 0
13 1 1 0
13 4 4 0
13 7 7 0
15 1 1 0
15 7 7 0
16 7 7 0
19 1 1 0
18 8 8 0
19 2 2 0
23 1 1 0
23 5 5 0
24 8 8 0
23 6 6 0
27 3 3 0
28 4 4 0
26 12 12 0
29 6 6 0
30 1 1 0
31 12 12 0
30 9 9 0...

output:

1 1 1 21 1 376 486548308 167934576 486539288 1 3898380 77967224 486539287 -1471584240 -1644157705 1 -1859308805 401163480 21 630618045 21 323077050 349887178 -1237443746 -1476223149 833996760 1880607 880909850 -1375559853 950886537 347624678 486539662 -1375559854 -105319810 174886127 859909419 54485...

result:

wrong answer 7th numbers differ - expected: '9022', found: '486548308'

Test #8:

score: 0
Wrong Answer
time: 716ms
memory: 149912kb

input:

8
4
100000
1 1 1 0
2 2 2 0
3 2 2 1
4 2 2 2
5 3 3 0
6 6 6 2
7 1 1 6
8 8 8 2
9 1 1 6
10 2 2 3
11 4 4 2
12 6 6 5
13 2 2 11
14 1 1 6
15 7 7 4
16 7 7 3
17 14 14 15
18 12 12 12
19 17 17 3
20 20 20 11
21 5 5 7
22 12 12 3
23 14 14 10
24 3 3 1
25 23 23 10
26 5 5 18
27 5 5 25
28 18 18 1
29 2 2 14
30 23 23 3
3...

output:

7 13 12 5 -603979750 5 4 25 24 -1140850595 -1140850591 -1140850595 24 24 -746585966 -1560280942 24 50 50 37 595591418 595591418 -1560280930 327156901 36 23 23 -1174404776 -956301183 -956301183 -511705032 23 23 713032168 713032168 713032161 713032154 -1417674705 9 9 9 9 9 9 9 285212992 9 -1006626654 ...

result:

wrong answer 5th numbers differ - expected: '18', found: '-603979750'

Test #9:

score: 0
Wrong Answer
time: 751ms
memory: 156488kb

input:

9
4
100000
1 1 1 0
1 1 1 0
1 1 1 0
3 1 1 0
4 2 2 1
6 2 2 2
6 1 1 2
8 3 3 2
9 1 1 4
8 4 4 0
9 4 4 0
12 6 6 3
13 3 3 4
13 6 6 3
15 5 5 0
15 2 2 7
15 4 4 2
17 5 5 2
18 5 5 0
18 4 4 6
19 2 2 8
22 8 8 9
23 3 3 10
24 6 6 12
25 7 7 13
24 1 1 11
27 3 3 7
27 12 12 2
28 4 4 0
30 3 3 9
31 15 15 15
32 1 1 7
31 ...

output:

1 1 15 1 14 0 13 57 0 1 42 27 0 -117440443 -117440469 11 -25165667 -25165698 -25165724 0 26 26 26 0 0 26 26 -1207959522 721420741 26 26 26 0 11 15 0 11 -25165713 11 11 905971047 721420715 11 243269880 0 -125828675 0 0 -125828702 -125828702 0 150996144 -125828702 176162046 0 83886317 176162046 -83882...

result:

wrong answer 14th numbers differ - expected: '39', found: '-117440443'

Test #10:

score: 0
Wrong Answer
time: 789ms
memory: 132112kb

input:

10
4
100000
1 1 1 0
2 1 1 0
3 3 3 0
4 3 4 0
5 3 5 0
6 1 4 0
7 5 5 0
8 5 7 0
9 3 6 0
10 6 10 0
11 1 2 0
12 8 11 0
13 4 12 0
14 2 12 0
15 7 10 0
16 6 8 0
17 13 15 0
18 8 9 0
19 2 6 0
20 8 14 0
21 3 18 0
22 11 18 0
23 5 11 0
24 6 12 0
25 3 24 0
26 13 23 0
27 3 8 0
28 14 22 0
29 4 26 0
30 1 5 0
31 13 17...

output:

16 527 788554977 -685980088 16864757 581528743 9478386 -1472286644 575293555 -1866989405 -1145776174 -1260783047 -1065493625 111864469 -574585868 -1003950786 813305696 -243800616 -1182167630 -1214206455 -1332162476 218842522 -574202063 -730336386 -1297132506 -1499352673 -1281488919 -965395195 -81164...

result:

wrong answer 3rd numbers differ - expected: '25807', found: '788554977'

Test #11:

score: 0
Wrong Answer
time: 910ms
memory: 162192kb

input:

11
4
100000
1 1 1 0
2 1 2 0
3 1 2 0
3 1 2 0
5 3 4 0
5 1 3 0
5 2 3 0
8 1 3 0
9 2 5 0
10 3 5 0
11 4 6 0
10 1 3 0
11 6 8 0
13 4 8 0
13 2 7 0
14 1 3 0
17 3 8 0
17 5 7 0
19 10 11 0
19 1 2 0
20 5 12 0
22 12 12 0
22 8 10 0
23 6 14 0
23 2 8 0
25 2 9 0
27 6 9 0
26 9 15 0
29 3 10 0
30 9 9 0
30 12 13 0
32 14 1...

output:

37 2478 2515 277066872 38 277069387 241763303 -865396443 -50889760 838897903 -202587597 -720670557 -1367419635 518832691 600790840 -1274562152 -279975897 -713940131 -1452135952 -1396139480 -152771838 -1817095311 -1319642280 -269987356 -733335887 655987888 -1698129368 -879804750 836043183 208266862 -...

result:

wrong answer 4th numbers differ - expected: '242769', found: '277066872'

Test #12:

score: 0
Wrong Answer
time: 898ms
memory: 162936kb

input:

12
4
100000
1 1 1 0
2 1 2 0
3 2 3 0
4 1 3 0
2 1 1 0
4 2 2 0
3 1 2 0
8 1 4 0
8 1 3 0
5 2 5 0
9 1 4 0
10 3 5 0
11 1 6 0
11 3 6 0
11 3 3 0
14 2 6 0
17 3 7 0
14 2 4 0
14 4 6 0
18 2 8 0
18 6 9 0
21 8 10 0
22 5 5 0
20 6 8 0
22 1 4 0
24 3 9 0
26 3 8 0
25 3 3 0
24 6 7 0
25 5 9 0
27 2 9 0
32 4 6 0
32 9 11 0
...

output:

69 7796 -2137816842 824067326 69 159391417 39327 94385 55058 129727771 141577 7866 -1849701488 -2137808976 -1147953232 482605199 450127495 -194158135 -1350048784 745620640 -405909685 7866 797677773 295152587 911829028 -147046783 189107308 195898711 -437427768 -1861805797 -2112653822 -409740360 -1123...

result:

wrong answer 3rd numbers differ - expected: '1278127', found: '-2137816842'

Test #13:

score: 0
Wrong Answer
time: 735ms
memory: 150728kb

input:

13
4
100000
1 1 1 0
2 1 2 1
3 1 2 2
4 1 3 2
5 1 5 4
6 1 4 4
7 6 6 1
8 3 7 5
9 3 4 4
10 5 6 2
11 6 9 4
12 5 11 9
13 1 3 4
14 6 10 10
15 4 6 8
16 3 8 6
17 1 9 3
18 3 13 8
19 3 11 10
20 2 4 11
21 12 13 0
22 13 17 20
23 9 17 1
24 10 11 16
25 22 25 9
26 5 9 4
27 12 27 26
28 13 13 22
29 8 23 1
30 21 23 19...

output:

25 24 23 48 23 122 194 169 -142606024 -142605978 214 96 47 47 528482617 -268432708 -268432474 16779002 -369097907 -369098076 -511704100 47 -268433661 94 94 -1417662691 21 -1442839721 -1165997416 360717343 -1652534967 -1006613664 788534643 469794591 -1031780123 746590798 746590798 830496244 360734195...

result:

wrong answer 9th numbers differ - expected: '239', found: '-142606024'

Test #14:

score: 0
Wrong Answer
time: 819ms
memory: 162180kb

input:

14
4
100000
1 1 1 0
1 1 1 0
1 1 1 0
4 1 2 1
1 1 1 0
5 1 1 2
6 1 1 0
6 2 2 1
5 2 3 2
5 1 2 1
7 2 2 1
8 1 2 1
11 2 4 1
11 4 4 2
15 2 4 0
13 1 3 3
15 1 3 3
18 2 4 4
16 2 5 5
16 4 4 0
18 6 6 4
22 4 4 5
18 2 5 5
20 5 6 5
24 1 6 4
25 5 6 2
22 3 4 1
28 3 7 0
25 2 4 4
29 1 6 4
27 3 8 0
28 5 5 7
30 2 3 1
33 ...

output:

1 1 68 67 2 0 4 1 1 337 159383688 2 136 200 159384160 0 131 0 0 159383688 131 0 0 136 135 318768924 -1677719525 -679475771 0 -1677720927 -352316883 62 -989854327 67116265 0 67116003 -511701715 61 -1677720665 -679474176 1 159383688 995 61 0 -1677718778 427822484 0 -276823129 0 -1384102708 436250314 4...

result:

wrong answer 11th numbers differ - expected: '67', found: '159383688'

Test #15:

score: 0
Wrong Answer
time: 831ms
memory: 164244kb

input:

15
4
100000
1 1 1 0
1 1 1 0
2 1 2 0
1 1 1 0
4 1 3 1
3 2 2 1
5 1 2 0
5 2 2 1
7 2 3 1
9 1 2 0
9 2 3 0
8 1 2 1
9 1 2 0
10 3 3 2
11 2 3 1
13 2 3 3
15 3 5 4
14 4 4 2
16 2 4 0
20 4 5 5
18 1 6 4
21 2 5 6
19 4 5 4
23 3 7 4
23 3 5 0
25 3 3 8
26 4 8 8
26 3 7 6
28 6 9 5
26 6 9 2
29 8 9 7
29 6 10 1
31 4 4 5
34 ...

output:

3 5 8 46 4 4 93 44 13 310 47 46 92 7 220 0 2 2 440 40 6 40 1 400 3608 0 0 671088957 620 2369 90 -327155000 1614 1614 -327155311 0 -327155621 993 993 0 343937994 268444317 -2004853641 -444584885 436211729 436211729 436209567 268447321 5850 436214733 811 4749 -1719662688 764 -444591475 645927587 64592...

result:

wrong answer 28th numbers differ - expected: '269', found: '671088957'

Test #16:

score: 0
Wrong Answer
time: 851ms
memory: 164072kb

input:

16
4
100000
1 1 1 0
1 1 1 0
1 1 1 0
1 1 1 0
5 2 2 1
5 1 1 0
5 1 2 1
4 1 2 0
7 1 2 2
6 1 2 0
7 2 3 0
12 1 4 0
11 1 1 2
13 1 4 0
14 3 3 4
12 1 4 0
16 2 2 1
18 1 7 5
19 6 6 5
20 4 5 1
17 2 5 4
22 1 3 4
23 1 3 3
21 5 5 9
22 3 4 3
24 1 7 3
23 2 5 1
27 2 5 4
25 2 8 7
29 6 7 3
27 5 9 6
30 10 11 6
30 1 2 3
...

output:

1 1 2 60 3 355 1 3 0 65 1360 3551 2 5326 2 1828 -75497279 62 763363393 -75497338 52 351 -578801474 1 763363744 -578788678 763366984 -578793112 461373827 -578794082 831 265 0 3603 402745369 243399794 -536870646 75498193 612368972 48 243398434 763384312 0 0 243394830 8563258 -956267148 -1719648155 218...

result:

wrong answer 17th numbers differ - expected: '64', found: '-75497279'

Test #17:

score: 0
Wrong Answer
time: 847ms
memory: 160956kb

input:

17
4
100000
1 1 1 0
1 1 1 0
1 1 1 0
2 1 1 0
2 1 2 1
4 1 1 0
3 1 2 1
7 2 3 0
8 3 3 0
6 1 3 0
9 2 3 0
8 1 3 1
9 3 4 2
11 3 4 3
13 2 3 0
12 4 5 4
16 1 2 1
15 1 2 2
19 2 5 5
16 3 5 4
19 1 4 5
21 3 4 5
23 3 5 0
21 1 6 1
23 3 3 2
25 1 2 2
26 1 3 0
26 5 6 6
27 2 4 3
28 1 5 8
31 2 3 5
29 3 7 1
32 7 10 10
32...

output:

4 54 4 4 3 19 53 34 1 9 24 159 5 1 316 1 436207883 0 0 50 0 48 -931134905 243270798 243270263 243270215 -1895824048 0 243270215 48 371 -931134807 1 262 -931134535 108 -1124070071 -931134322 0 -931134219 -1124070381 -931134643 -1652553104 503320783 713034351 -2055205290 -520087671 54 0 -847246055 -93...

result:

wrong answer 17th numbers differ - expected: '159', found: '436207883'

Test #18:

score: 0
Wrong Answer
time: 845ms
memory: 161012kb

input:

18
4
100000
1 1 1 0
1 1 1 0
3 1 2 1
2 1 2 0
2 2 2 0
5 1 3 1
6 1 1 1
6 2 3 2
6 1 3 2
9 1 4 1
10 2 3 1
12 1 3 0
10 1 4 2
11 2 5 0
12 4 5 1
14 2 4 1
15 5 6 2
16 4 5 5
18 3 3 5
18 1 6 4
18 3 4 4
21 2 4 3
21 4 7 4
23 7 9 3
23 1 5 3
25 3 5 3
26 5 6 2
25 1 7 4
29 3 4 6
30 4 11 2
29 1 3 3
29 1 5 6
32 9 12 0...

output:

47 2 1 96 44 48 0 40 3 2679 183 671088918 95 2627 48 94 2495 0 0 2447 0 268473252 131 645962950 -1375720968 452992764 -1375726274 645960231 2810 268483631 645961912 47 209841185 914424613 47 209841053 645940982 671088772 209840922 645935453 495207204 0 721468463 218401113 2811 -427534894 2811 1 -427...

result:

wrong answer 12th numbers differ - expected: '230', found: '671088918'

Test #19:

score: 0
Wrong Answer
time: 822ms
memory: 162656kb

input:

19
4
100000
1 1 1 0
1 1 1 0
1 1 1 0
2 1 2 1
2 2 2 0
3 1 1 1
4 1 1 0
8 1 3 0
7 2 2 0
8 2 2 2
8 1 1 1
11 2 4 3
13 1 3 2
13 1 3 1
12 1 2 0
15 2 5 1
16 4 5 0
18 4 5 3
17 2 4 0
19 3 6 5
21 4 8 2
21 2 6 4
23 7 8 6
22 1 4 3
22 1 3 2
24 1 8 1
25 5 5 1
26 3 3 2
26 1 10 5
30 8 9 0
29 3 5 2
29 3 6 0
31 4 7 10
...

output:

3 1 43 1 1 0 515 559 1 1 427 1 973079087 645924495 1884 671089762 942 898 318769344 340 218116352 973080587 973079645 218108562 -33543006 947919812 218107620 -1073726674 3978 1108 184566970 436225210 164 2 906006124 -109022536 558 721426061 559 -142564434 33 2870 1 -327146808 -754925788 -142572230 4...

result:

wrong answer 13th numbers differ - expected: '515', found: '973079087'

Test #20:

score: 0
Wrong Answer
time: 835ms
memory: 161888kb

input:

20
4
100000
1 1 1 0
1 1 1 0
1 1 1 0
3 1 2 1
5 1 1 0
4 1 2 1
5 1 1 2
8 4 4 0
8 1 2 3
10 3 4 0
11 5 5 3
10 3 4 2
11 2 3 3
12 1 7 6
14 1 2 1
15 5 8 3
15 1 2 6
17 5 8 4
17 3 4 0
18 7 9 6
20 1 10 2
21 1 4 9
22 1 9 9
23 3 8 6
25 3 7 8
24 2 7 6
27 1 9 8
27 12 12 8
29 3 11 3
30 2 6 4
31 6 14 8
30 6 8 3
33 8...

output:

1 44 2 43 973078615 1 42 1 41 172 85 87 0 41 -1098907305 816 45 170 -1098906406 88 814 0 345 947912874 0 -1426061914 922747051 947913806 -1300222062 721424095 973078996 -1400891089 25167109 947915807 -201325185 -1098903202 -1384111518 -176156321 -184541859 1284 -1375728548 0 2693 0 0 168 0 168 -5116...

result:

wrong answer 5th numbers differ - expected: '43', found: '973078615'