QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#622525#2060. White MageZhaoZiLongAC ✓78ms4728kbC++202.0kb2024-10-08 22:19:162024-10-08 22:19:17

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 4636kb

input:

5 6
2 1 2 10
3 3 4 5 18
2 4 5 6
1 3 7
1 2 4
1 1 11

output:

23

result:

ok answer is '23'

Test #2:

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

input:

3 2
2 1 2 5
2 2 3 5

output:

-1

result:

ok answer is '-1'

Test #3:

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

input:

3 4
3 1 2 3 10
1 1 2
1 2 3
1 3 4

output:

9

result:

ok answer is '9'

Test #4:

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

input:

3 4
3 1 2 3 8
1 1 2
1 2 3
1 3 4

output:

8

result:

ok answer is '8'

Test #5:

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

input:

3 3
2 2 3 8
2 1 3 2
2 1 2 3

output:

-1

result:

ok answer is '-1'

Test #6:

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

input:

1 0

output:

-1

result:

ok answer is '-1'

Test #7:

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

input:

1 10
1 1 345
1 1 335
1 1 325
1 1 200
1 1 500
1 1 345
1 1 335
1 1 325
1 1 600
1 1 500

output:

200

result:

ok answer is '200'

Test #8:

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

input:

15 15
1 1 1
1 2 1
1 3 1
1 4 1
1 5 1
1 6 1
1 7 1
1 8 1
1 9 1
1 10 1
1 11 1
1 12 1
1 13 1
1 14 1
1 15 1

output:

15

result:

ok answer is '15'

Test #9:

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

input:

15 100
1 1 1
1 2 1
1 3 1
1 4 1
1 5 1
1 6 1
1 7 1
1 8 1
1 9 1
1 10 1
1 11 1
1 12 1
1 13 1
1 14 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1 15 1
1...

output:

15

result:

ok answer is '15'

Test #10:

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

input:

15 100
1 1 1
1 2 1
1 3 1
1 4 1
1 5 1
1 6 1
1 7 1
1 8 1
1 9 1
1 10 1
1 11 1
1 12 1
1 13 1
1 14 1
1 15 1
15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1000
15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1000
15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1000
15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1000
15 1 2 3 4 5 6 7 8 9 ...

output:

15

result:

ok answer is '15'

Test #11:

score: 0
Accepted
time: 28ms
memory: 4660kb

input:

18 100
1 1 1
1 2 1
1 3 1
1 4 1
1 5 1
1 6 1
1 7 1
1 8 1
1 9 1
1 10 1
1 11 1
1 12 1
1 13 1
1 14 1
1 15 1
1 16 1
1 17 1
1 18 1
18 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1000
18 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1000
18 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1000
18 1 2 3 4 5 6 7 ...

output:

18

result:

ok answer is '18'

Test #12:

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

input:

16 100
1 1 1
1 2 1
1 3 1
1 4 1
1 5 1
1 6 1
1 7 1
1 8 1
1 9 1
1 10 1
1 11 1
1 12 1
1 13 1
1 14 1
1 15 1
1 16 1
16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1000
16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1000
16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1000
16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1000
16...

output:

16

result:

ok answer is '16'

Test #13:

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

input:

1 0

output:

-1

result:

ok answer is '-1'

Test #14:

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

input:

10 0

output:

-1

result:

ok answer is '-1'

Test #15:

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

input:

18 0

output:

-1

result:

ok answer is '-1'

Test #16:

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

input:

1 1
1 1 409

output:

409

result:

ok answer is '409'

Test #17:

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

input:

5 1
5 4 2 5 1 3 400

output:

400

result:

ok answer is '400'

Test #18:

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

input:

10 1
10 1 3 7 10 2 5 6 9 4 8 549

output:

549

result:

ok answer is '549'

Test #19:

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

input:

18 1
18 4 17 13 7 15 11 16 5 9 3 10 2 12 18 8 6 1 14 997

output:

997

result:

ok answer is '997'

Test #20:

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

input:

1 100
1 1 806
1 1 23
1 1 585
1 1 363
1 1 767
1 1 905
1 1 857
1 1 916
1 1 487
1 1 144
1 1 994
1 1 229
1 1 156
1 1 626
1 1 381
1 1 803
1 1 1
1 1 718
1 1 769
1 1 2
1 1 831
1 1 888
1 1 310
1 1 78
1 1 265
1 1 913
1 1 538
1 1 548
1 1 461
1 1 574
1 1 606
1 1 872
1 1 328
1 1 895
1 1 287
1 1 430
1 1 792
1 1 ...

output:

1

result:

ok answer is '1'

Test #21:

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

input:

5 100
5 3 2 5 1 4 970
5 2 5 1 4 3 436
5 1 2 4 3 5 672
5 5 3 1 2 4 484
5 2 1 3 4 5 644
5 2 5 4 3 1 7
5 4 1 2 5 3 497
5 2 4 1 3 5 112
5 4 2 5 3 1 171
5 3 5 4 1 2 80
5 4 1 5 3 2 388
5 1 3 5 4 2 594
5 3 1 4 5 2 546
5 5 4 2 1 3 856
5 2 5 3 4 1 882
5 3 1 2 5 4 105
5 1 2 4 3 5 849
5 4 2 1 5 3 627
5 3 2 1 5...

output:

7

result:

ok answer is '7'

Test #22:

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

input:

10 100
10 2 4 5 6 1 3 8 10 7 9 187
10 7 8 1 4 5 9 10 6 2 3 861
10 8 9 2 6 3 1 4 5 10 7 531
10 8 3 6 10 1 9 4 5 7 2 333
10 5 8 4 9 10 2 7 1 3 6 825
10 10 1 6 7 4 3 9 5 8 2 361
10 5 3 8 10 1 2 7 4 9 6 242
10 2 6 4 3 8 10 9 7 5 1 618
10 5 6 4 3 8 10 7 2 9 1 667
10 8 7 5 10 9 1 6 2 4 3 225
10 5 4 10 9 1...

output:

4

result:

ok answer is '4'

Test #23:

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

input:

18 100
18 2 17 4 15 8 1 16 5 7 14 13 10 11 12 3 6 18 9 403
18 18 13 8 6 11 9 16 14 3 7 4 17 12 2 5 1 15 10 959
18 15 13 9 4 11 8 18 2 17 7 1 14 5 12 10 16 6 3 72
18 5 2 1 15 17 13 12 3 14 9 11 7 10 16 8 4 18 6 159
18 15 17 3 13 11 5 9 18 16 4 7 6 12 2 1 14 10 8 74
18 11 10 3 18 14 4 12 8 15 6 7 2 1 ...

output:

5

result:

ok answer is '5'

Test #24:

score: 0
Accepted
time: 20ms
memory: 4632kb

input:

17 100
2 1 3 125
2 6 3 165
2 11 7 389
2 13 16 792
2 7 14 621
2 11 5 880
2 8 9 222
2 14 16 597
2 4 8 18
2 13 16 48
2 8 6 560
2 12 11 451
2 9 3 978
2 4 1 895
2 4 3 281
2 13 14 668
2 9 6 390
2 13 14 252
2 7 10 947
2 10 15 743
2 12 10 471
2 9 13 798
2 7 13 540
2 9 5 852
2 9 3 660
2 15 2 279
2 11 1 545
2...

output:

-1

result:

ok answer is '-1'

Test #25:

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

input:

17 100
3 9 10 12 912
3 15 9 10 76
3 13 8 9 466
3 5 1 4 258
3 15 13 4 870
3 11 7 16 901
3 16 7 8 120
3 14 15 11 740
3 11 10 15 933
3 3 15 5 506
3 7 11 5 623
3 5 3 6 195
3 13 12 11 170
3 11 2 12 551
3 11 6 12 761
3 16 7 11 698
3 8 9 11 628
3 1 17 15 38
3 3 15 11 139
3 2 15 12 966
3 10 1 17 260
3 14 10...

output:

-1

result:

ok answer is '-1'

Test #26:

score: 0
Accepted
time: 17ms
memory: 4676kb

input:

17 100
3 4 15 1 647
2 12 7 450
2 12 8 940
3 7 2 1 858
2 11 7 892
2 3 1 700
3 11 3 13 314
3 16 9 13 45
2 14 7 804
2 17 9 15
3 7 17 13 816
2 8 11 205
2 8 11 479
2 15 4 156
3 4 13 3 750
2 6 3 150
3 7 17 16 423
3 9 1 3 541
3 11 8 2 170
2 11 12 615
3 10 15 5 227
3 12 11 5 54
2 17 9 670
2 17 9 203
2 11 4 ...

output:

903

result:

ok answer is '903'

Test #27:

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

input:

18 100
5 12 6 11 9 17 474
5 8 7 6 18 4 777
5 2 8 6 7 5 932
5 2 14 3 12 9 320
5 15 1 7 13 11 744
5 13 1 14 3 4 606
5 16 6 3 15 12 765
5 7 10 5 18 14 144
5 12 8 9 13 11 405
5 15 5 17 9 8 619
5 7 11 3 14 4 412
5 5 13 7 17 4 687
5 3 9 10 12 4 460
5 6 7 13 16 2 214
5 7 5 4 6 8 560
5 12 10 18 6 5 478
5 4 ...

output:

-1

result:

ok answer is '-1'

Test #28:

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

input:

18 100
2 4 13 144
2 8 4 122
1 4 57
4 7 12 14 15 260
2 9 10 122
5 18 7 1 3 6 299
2 9 18 156
1 8 98
1 3 71
4 4 3 10 16 247
2 7 4 142
3 6 5 10 188
1 3 56
1 8 70
1 12 74
5 7 9 17 6 18 291
5 15 8 14 9 5 301
1 13 98
1 13 82
3 12 2 16 164
3 18 1 17 180
2 9 13 105
3 14 4 5 164
2 2 7 141
1 18 95
5 10 17 9 2 ...

output:

1042

result:

ok answer is '1042'

Test #29:

score: 0
Accepted
time: 26ms
memory: 4588kb

input:

18 100
5 18 1 4 15 7 289
3 8 12 17 204
4 17 9 8 15 222
4 9 16 13 12 250
4 15 18 17 14 260
3 14 6 15 156
3 10 13 11 171
5 5 17 15 18 8 277
1 10 80
3 17 4 9 191
2 15 1 119
2 17 8 139
3 8 3 10 192
1 18 66
1 2 96
4 3 10 8 5 225
2 17 4 139
1 16 84
1 5 52
3 18 4 13 173
5 18 13 12 16 15 274
4 10 1 15 16 23...

output:

1003

result:

ok answer is '1003'

Test #30:

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

input:

18 100
4 1 7 16 17 227
3 12 5 7 170
1 4 98
3 15 2 11 185
4 1 5 11 3 252
2 15 16 150
5 14 12 16 17 15 295
2 2 8 118
4 10 15 11 6 223
5 13 6 10 2 7 284
3 8 9 4 178
5 14 11 8 12 6 278
2 18 3 135
4 1 9 18 17 215
4 4 11 14 18 233
2 3 14 105
4 17 1 4 9 231
2 16 6 150
2 16 17 139
2 18 5 143
3 15 10 6 169
4...

output:

998

result:

ok answer is '998'

Test #31:

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

input:

18 100
4 5 12 14 8 210
5 4 7 11 12 2 260
2 12 14 144
3 1 17 15 167
4 4 14 8 16 239
5 12 16 18 15 4 290
1 6 84
4 15 5 11 8 259
2 15 16 143
2 17 2 113
2 14 8 156
4 3 1 9 18 250
3 17 4 10 192
4 12 8 17 3 216
5 17 15 11 9 10 307
4 4 1 3 11 234
1 18 85
3 9 5 7 161
5 9 2 15 7 11 276
4 18 7 12 15 230
5 6 9...

output:

1002

result:

ok answer is '1002'

Test #32:

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

input:

18 100
3 14 8 15 183
2 13 14 145
3 8 16 18 171
1 9 76
3 9 17 6 164
2 6 5 119
1 5 90
5 13 9 17 8 6 292
5 3 7 14 8 6 309
5 8 1 2 7 17 298
5 15 7 10 5 17 312
4 6 5 17 14 236
3 11 10 12 165
3 17 12 8 205
1 18 56
3 12 14 8 176
1 2 87
3 14 2 5 185
5 10 13 9 8 16 289
2 10 2 126
4 4 9 18 13 220
4 11 14 18 9...

output:

1040

result:

ok answer is '1040'

Test #33:

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

input:

18 100
5 4 14 8 13 16 292
2 10 16 132
6 8 1 14 17 10 18 337
6 2 14 12 16 11 7 328
4 5 7 18 10 236
1 5 86
3 6 15 16 174
2 18 10 140
9 18 3 17 2 9 14 13 11 15 472
3 3 8 10 192
2 8 16 128
5 10 4 13 9 1 311
4 7 6 12 11 234
8 12 16 5 8 13 11 3 1 429
3 13 10 1 208
3 16 5 14 186
4 17 8 11 12 215
6 4 2 18 1...

output:

1011

result:

ok answer is '1011'

Test #34:

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

input:

18 100
3 9 6 14 205
3 13 10 7 177
5 8 7 2 14 4 271
4 17 8 5 7 209
7 14 13 11 15 3 18 1 405
2 14 8 139
1 10 97
1 5 103
2 7 6 138
3 2 5 6 184
7 3 16 14 2 8 11 15 409
5 7 5 2 13 9 297
2 2 18 108
10 9 18 1 12 10 4 15 11 17 2 538
8 3 14 9 4 17 2 13 10 451
2 12 5 152
1 8 69
3 11 14 17 164
9 1 3 7 2 5 17 1...

output:

1045

result:

ok answer is '1045'

Test #35:

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

input:

18 100
7 17 8 12 10 5 6 9 373
4 7 1 3 6 235
7 8 11 10 15 5 16 2 392
6 9 12 4 7 2 3 319
10 4 7 3 14 9 11 17 8 16 1 549
5 15 6 4 17 13 281
5 8 9 17 6 14 291
3 5 8 17 160
1 17 99
8 16 12 5 9 13 14 3 10 459
9 10 4 16 12 7 5 3 9 2 490
8 6 16 13 9 14 17 3 1 441
8 12 6 14 11 15 9 18 5 465
10 11 13 5 8 3 7 ...

output:

1015

result:

ok answer is '1015'

Test #36:

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

input:

18 100
1 14 67
1 11 65
2 12 10 132
4 11 17 8 13 209
9 6 13 9 15 16 2 5 18 3 498
6 17 1 5 3 8 10 353
3 13 14 10 156
9 10 17 15 2 7 3 11 12 13 518
6 6 9 1 10 8 3 364
10 8 4 2 14 1 6 13 11 5 9 539
1 10 57
8 4 12 13 3 18 9 10 6 430
1 14 63
10 7 11 4 9 17 18 2 8 14 16 535
3 6 2 13 159
6 1 4 17 15 13 16 3...

output:

1003

result:

ok answer is '1003'

Test #37:

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

input:

18 100
9 18 9 3 5 15 4 12 13 11 497
2 12 5 107
6 11 16 6 7 15 2 331
6 6 2 15 10 4 14 350
1 3 66
4 13 4 6 16 214
4 5 10 1 12 249
8 7 8 4 1 13 9 11 17 433
8 15 10 7 18 3 1 8 6 441
10 7 13 14 3 8 18 12 4 15 17 525
4 8 13 14 11 254
2 4 17 106
7 1 11 12 8 14 5 16 382
8 14 11 7 16 12 15 18 4 455
1 17 72
5...

output:

1004

result:

ok answer is '1004'

Test #38:

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

input:

18 100
3 17 6 18 194
15 12 7 15 8 1 13 2 9 5 14 18 10 4 6 3 807
6 3 18 11 8 17 16 350
14 9 15 18 10 17 16 6 8 14 4 7 2 12 11 737
4 6 12 4 1 213
7 7 18 15 12 16 10 3 371
6 7 10 5 17 11 16 356
5 8 7 17 6 18 311
2 13 7 124
2 14 9 129
5 9 10 13 15 11 277
15 5 18 9 7 6 11 14 16 15 12 1 8 10 2 3 802
11 16...

output:

1099

result:

ok answer is '1099'

Test #39:

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

input:

18 100
1 13 62
14 6 13 9 17 12 11 7 16 5 14 2 15 10 3 767
1 18 86
3 6 1 5 185
14 11 14 13 12 3 5 9 10 17 6 8 7 2 1 774
3 15 17 7 158
14 5 10 2 4 13 12 15 1 8 9 6 11 16 17 745
14 2 9 15 10 13 16 14 7 11 5 3 1 18 17 779
9 11 7 14 10 1 4 9 18 15 485
2 3 13 104
3 4 16 6 160
1 14 60
11 7 17 10 2 11 16 13...

output:

998

result:

ok answer is '998'

Test #40:

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

input:

18 100
15 13 4 3 12 18 1 7 5 8 16 14 6 10 2 15 790
6 2 4 17 12 10 3 332
7 7 15 4 6 16 14 2 364
8 14 9 3 12 7 4 8 15 426
10 17 12 2 6 15 9 11 13 8 10 523
8 8 4 17 10 5 15 6 12 448
2 4 3 119
9 7 14 1 4 10 2 16 17 13 482
6 17 18 5 12 14 15 338
5 4 3 13 2 10 288
9 8 4 14 11 3 13 18 1 9 518
5 10 17 14 3 ...

output:

1018

result:

ok answer is '1018'

Test #41:

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

input:

18 100
14 8 17 11 3 13 14 16 15 2 5 10 18 1 4 729
6 5 2 9 12 6 10 319
8 16 1 9 12 18 3 13 6 428
9 6 17 14 4 3 13 11 18 8 490
13 16 18 17 13 14 3 4 7 2 6 8 12 1 678
13 13 8 7 9 14 6 12 4 16 11 10 5 15 720
13 14 4 15 1 12 17 13 16 8 6 2 11 18 708
1 15 60
9 5 11 2 4 12 10 1 7 3 508
1 13 82
14 6 10 12 1...

output:

-1

result:

ok answer is '-1'

Test #42:

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

input:

18 100
12 8 5 13 11 7 3 17 1 2 6 16 15 631
11 13 1 15 14 9 7 17 18 5 4 3 586
5 11 2 6 1 15 262
1 2 102
1 8 62
5 2 4 7 10 16 300
6 10 3 15 13 7 16 322
9 7 12 6 10 16 17 1 3 15 487
1 2 68
10 5 15 16 9 3 1 18 2 11 13 535
14 2 4 14 3 6 1 13 7 10 16 15 12 17 18 763
11 18 7 15 5 3 12 10 11 6 8 2 609
13 18...

output:

1090

result:

ok answer is '1090'

Test #43:

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

input:

18 100
9 11 13 7 12 17 5 2 14 10 484
9 7 16 12 17 2 4 6 18 5 506
9 11 2 17 8 1 12 9 14 18 497
9 7 1 11 5 2 18 9 4 17 473
9 18 16 5 17 3 14 2 7 12 502
9 7 4 14 10 18 9 16 11 6 480
9 1 16 3 8 5 14 10 2 7 490
9 4 14 9 18 5 1 12 15 6 511
9 10 8 7 16 11 17 14 4 15 475
9 4 15 18 8 11 6 2 10 16 496
9 12 3 ...

output:

-1

result:

ok answer is '-1'

Test #44:

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

input:

18 100
9 11 5 15 14 12 8 1 17 13 502
9 13 11 2 8 12 14 16 7 10 514
9 10 17 3 9 1 13 5 14 7 470
9 17 14 1 6 8 15 3 7 11 486
9 5 1 18 11 2 8 6 4 16 481
9 12 14 3 18 8 17 4 9 1 498
9 16 10 7 14 8 17 13 15 12 502
9 6 2 15 5 17 8 12 18 1 490
9 16 1 15 9 2 6 14 11 4 468
9 2 14 3 4 7 6 18 17 8 500
9 18 14 ...

output:

-1

result:

ok answer is '-1'

Test #45:

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

input:

18 100
9 11 10 16 15 2 9 1 7 5 477
9 12 15 5 2 7 16 17 4 11 482
9 12 5 2 8 18 14 9 16 10 494
9 10 5 9 6 1 12 14 3 18 485
9 14 6 13 11 4 2 16 9 5 504
9 18 11 1 4 9 6 7 8 2 481
9 1 15 13 8 11 4 16 7 6 516
9 3 10 14 9 6 18 4 2 7 499
9 3 14 4 10 8 7 11 13 5 477
9 6 11 18 16 1 12 10 4 5 497
9 17 4 15 11 ...

output:

-1

result:

ok answer is '-1'

Test #46:

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

input:

18 100
9 2 14 7 15 13 12 3 10 8 517
9 17 14 9 11 3 2 5 15 7 483
9 4 5 17 3 18 16 9 2 8 516
9 7 1 6 14 5 3 4 11 15 509
9 16 1 6 11 9 10 8 7 14 490
9 1 17 18 3 15 4 5 8 14 504
9 4 9 6 13 10 8 16 2 7 516
9 16 8 6 12 1 4 14 10 2 474
9 16 4 6 1 10 14 12 5 17 514
9 4 15 11 18 16 8 13 1 2 490
9 18 7 14 17 ...

output:

-1

result:

ok answer is '-1'

Test #47:

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

input:

18 100
9 2 8 10 13 18 7 1 17 15 474
9 8 5 3 18 1 6 9 16 2 505
9 11 5 12 2 1 18 14 8 13 484
9 16 4 9 14 10 18 5 8 7 519
9 14 12 5 15 3 2 4 17 10 493
9 10 14 13 7 3 18 2 8 11 516
9 7 3 1 13 4 6 8 10 9 516
9 14 15 6 18 2 5 10 16 4 514
9 1 9 4 17 2 15 10 6 8 504
9 17 11 6 8 5 7 12 3 10 496
9 11 16 3 17 ...

output:

-1

result:

ok answer is '-1'

Test #48:

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

input:

18 100
13 15 18 16 8 13 9 11 1 6 14 2 3 7 678
11 3 16 5 4 1 13 12 18 15 9 10 593
11 1 13 15 8 5 12 10 11 7 3 18 612
10 4 10 11 16 18 17 1 15 5 13 572
14 14 7 18 8 5 17 10 4 11 2 3 6 16 15 768
10 9 1 16 11 3 13 7 6 12 18 527
13 10 16 15 8 7 13 5 9 12 18 4 17 1 722
13 12 8 14 9 7 4 6 3 1 15 2 11 5 678...

output:

-1

result:

ok answer is '-1'

Test #49:

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

input:

18 100
13 15 1 14 9 18 3 12 17 5 4 11 6 2 705
17 7 17 18 1 4 10 13 2 5 8 3 11 16 9 12 14 15 910
10 18 2 15 6 1 11 7 4 14 10 543
15 2 8 1 11 9 10 12 14 4 18 17 6 5 15 7 827
16 5 3 1 10 17 12 15 16 8 2 18 13 4 6 9 7 872
10 11 18 12 6 15 7 17 9 8 3 563
12 2 16 12 15 6 3 14 8 5 17 7 10 638
17 14 8 17 7 ...

output:

-1

result:

ok answer is '-1'

Test #50:

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

input:

18 100
13 16 15 17 4 14 10 18 1 6 8 12 11 7 703
12 9 17 18 2 11 16 14 8 3 12 6 13 656
16 11 16 2 5 17 12 6 9 18 3 7 1 10 8 4 14 834
14 4 11 15 12 8 10 7 9 16 3 1 5 14 18 779
10 3 14 15 1 4 18 2 6 9 11 528
13 15 16 13 11 6 18 7 1 9 12 14 2 8 686
13 17 1 14 15 11 5 13 18 9 7 16 8 3 685
12 14 17 3 6 4 ...

output:

-1

result:

ok answer is '-1'

Test #51:

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

input:

18 100
13 16 3 17 6 12 7 2 11 8 14 5 1 9 712
16 14 16 11 8 18 2 3 13 6 4 15 7 12 5 17 1 834
11 3 11 13 17 8 18 9 6 12 15 14 577
12 3 9 18 4 10 12 5 8 11 14 6 17 638
16 11 18 9 14 5 10 8 1 2 7 12 3 15 17 13 6 883
17 4 17 13 8 6 18 2 3 16 1 5 14 11 15 9 12 7 929
16 5 3 15 11 18 8 6 14 1 17 9 10 7 12 4...

output:

-1

result:

ok answer is '-1'

Test #52:

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

input:

18 100
13 2 12 1 8 3 5 16 14 10 17 18 7 15 725
17 2 8 13 5 4 14 10 17 3 11 16 7 15 6 18 1 9 911
12 15 3 9 5 6 17 7 8 2 18 14 12 636
12 17 9 4 7 18 11 10 14 13 2 15 5 632
13 2 10 6 13 5 12 15 16 9 17 1 18 7 695
14 13 7 17 9 1 4 3 8 18 5 10 6 11 12 740
15 11 4 3 10 2 8 6 12 9 18 5 14 16 7 15 795
10 10...

output:

-1

result:

ok answer is '-1'

Test #53:

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

input:

18 100
9 2 8 10 13 18 7 1 17 15 474
9 8 5 3 18 1 6 9 16 2 505
9 11 5 12 2 1 18 14 8 13 484
9 16 4 9 14 10 18 5 8 7 519
9 14 12 5 15 3 2 4 17 10 493
9 10 14 13 7 3 18 2 8 11 516
9 7 3 1 13 4 6 8 10 9 516
9 14 15 6 18 2 5 10 16 4 514
9 1 9 4 17 2 15 10 6 8 504
9 2 3 9 10 14 15 16 18 12 480
9 17 11 6 8...

output:

979

result:

ok answer is '979'

Test #54:

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

input:

18 100
12 6 13 16 8 4 12 15 5 7 14 9 18 644
7 5 9 17 1 2 6 16 365
1 12 102
10 10 12 1 3 7 2 15 16 11 13 523
9 15 1 9 2 10 7 12 8 11 480
4 8 13 3 6 250
9 9 7 2 13 12 11 18 1 5 499
4 8 5 16 4 216
1 3 77
8 10 16 13 15 18 7 11 5 438
1 9 56
4 16 17 2 5 235
1 14 86
11 5 2 11 4 7 10 9 12 18 17 14 572
16 10...

output:

952

result:

ok answer is '952'

Test #55:

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

input:

18 100
2 10 9 125
9 15 3 18 5 7 4 16 11 9 502
17 7 9 8 6 1 13 5 10 2 15 11 3 4 16 14 17 12 888
13 16 5 12 18 13 10 2 7 14 17 8 9 1 711
13 11 3 18 7 2 6 5 10 8 4 1 12 16 717
11 6 12 11 1 2 7 8 16 10 18 15 580
14 11 10 8 4 6 3 9 7 14 5 16 2 12 13 745
13 13 10 2 17 11 14 16 18 6 7 9 4 15 727
9 11 1 10 ...

output:

948

result:

ok answer is '948'

Test #56:

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

input:

18 100
10 6 5 16 2 10 7 12 14 11 3 564
16 1 5 12 15 9 18 13 3 17 7 14 8 6 16 11 10 863
15 8 14 12 13 9 7 16 18 5 1 15 6 17 3 4 807
15 12 18 5 1 10 3 11 13 16 8 9 14 4 2 15 785
15 3 17 7 11 4 8 9 10 12 2 1 16 14 5 13 805
10 11 7 6 16 18 13 5 1 12 2 539
13 17 1 10 4 8 7 5 3 11 18 13 2 9 701
5 13 2 8 1...

output:

943

result:

ok answer is '943'

Test #57:

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

input:

18 100
14 7 10 6 16 15 8 2 4 13 1 9 3 18 5 743
18 8 18 16 13 12 9 10 17 1 5 4 11 7 2 14 15 3 6 984
3 17 12 1 162
8 9 7 1 12 4 2 6 10 441
7 10 18 7 3 13 17 4 402
12 1 16 15 6 2 4 18 11 3 12 8 14 634
6 15 17 4 7 5 10 322
8 5 2 8 14 9 16 7 1 456
11 16 6 10 9 1 3 15 7 11 18 8 586
3 13 9 16 170
3 14 9 7 ...

output:

938

result:

ok answer is '938'

Test #58:

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

input:

18 100
4 1 2 11 17 250
11 12 2 14 9 5 13 6 4 10 7 1 615
14 16 11 15 14 17 1 5 3 18 8 2 13 4 10 773
10 16 6 4 5 12 1 15 11 8 10 531
10 5 6 4 9 2 15 3 11 7 8 568
16 16 3 18 8 13 1 14 7 11 2 17 12 15 9 10 5 882
7 11 16 7 5 14 17 10 385
2 1 14 131
3 11 3 10 195
18 2 3 11 4 14 13 12 6 9 18 15 16 17 1 10 ...

output:

938

result:

ok answer is '938'

Test #59:

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

input:

18 100
9 4 13 14 2 9 7 12 5 1 664
1 4 873
13 15 11 17 4 6 13 14 5 12 10 16 18 1 919
6 14 7 4 1 15 8 446
1 7 402
2 14 18 441
4 16 2 17 13 91
18 9 13 10 5 18 14 2 8 12 7 4 1 11 17 15 3 16 6 175
4 3 9 7 12 382
12 11 13 7 4 5 2 15 18 3 12 16 10 312
18 5 16 4 1 12 13 11 2 8 10 6 9 15 17 3 14 7 18 282
7 1...

output:

16

result:

ok answer is '16'

Test #60:

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

input:

18 100
17 4 15 8 18 2 7 17 9 10 16 1 11 13 12 5 14 3 22
10 18 3 9 7 14 2 8 13 1 11 659
9 10 12 5 17 15 18 1 14 7 136
3 10 14 13 589
3 12 5 2 154
9 3 17 4 10 18 1 5 16 13 151
1 4 291
8 6 10 12 15 9 18 7 17 38
12 6 17 9 4 1 3 12 2 7 18 5 14 474
4 8 7 18 1 983
16 15 7 5 11 13 2 16 17 4 12 3 1 18 10 8 6...

output:

117

result:

ok answer is '117'

Test #61:

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

input:

18 100
7 9 6 5 12 14 4 11 416
3 6 10 7 461
10 5 18 9 15 8 11 1 4 13 16 927
14 10 12 11 8 16 18 17 1 4 13 3 6 9 14 352
15 6 15 3 17 7 8 13 11 1 9 4 14 2 18 10 589
12 6 15 3 8 10 9 1 13 12 18 17 2 617
3 4 12 18 156
6 1 2 11 13 15 16 989
2 13 9 918
15 6 10 8 4 7 2 17 9 5 3 14 16 12 15 1 566
12 3 13 18 ...

output:

63

result:

ok answer is '63'

Test #62:

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

input:

18 100
11 17 12 11 15 4 1 2 5 14 18 10 378
11 3 2 11 16 7 17 14 10 5 1 13 5
3 17 9 15 50
2 3 15 869
3 11 18 9 76
4 16 7 8 3 518
10 8 5 14 18 4 2 13 16 1 7 653
3 7 1 9 996
18 10 4 7 16 14 13 5 1 3 8 12 2 18 6 11 17 15 9 977
7 15 9 12 8 3 14 17 22
7 17 15 7 14 13 11 4 410
14 4 11 2 3 17 18 14 10 1 8 1...

output:

32

result:

ok answer is '32'

Test #63:

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

input:

18 100
15 17 8 9 16 14 6 2 13 11 5 10 18 3 15 4 323
4 11 18 7 15 108
9 7 16 17 14 9 2 13 12 10 385
9 11 10 13 14 8 3 18 9 5 827
15 3 16 6 17 12 9 1 15 5 7 2 10 18 14 8 680
8 6 3 2 8 11 18 1 5 882
1 16 647
10 11 9 18 12 6 3 17 10 1 16 579
3 4 1 17 79
15 15 3 8 14 5 10 6 4 16 2 18 17 9 13 7 818
6 6 13...

output:

114

result:

ok answer is '114'

Test #64:

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

input:

18 100
17 10 6 15 8 5 14 18 3 9 7 13 17 12 11 4 16 1 922
12 11 5 13 17 15 2 10 6 16 7 1 18 645
6 1 8 18 5 10 2 341
11 14 17 2 15 11 3 10 6 13 7 4 599
14 16 13 14 8 1 5 6 2 11 15 9 18 7 12 751
6 10 8 16 6 11 2 338
12 17 11 16 8 7 5 3 15 2 1 18 13 649
17 1 4 10 2 11 14 5 3 7 16 17 9 8 13 18 6 12 935
1...

output:

972

result:

ok answer is '972'

Test #65:

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

input:

18 100
4 14 11 5 10 214
16 2 11 12 4 17 13 3 15 14 18 9 5 8 10 6 16 879
6 2 15 4 11 7 18 342
7 4 10 7 12 9 1 11 409
9 9 16 10 15 6 11 14 3 2 473
17 11 17 7 5 12 3 1 9 14 16 15 18 4 2 10 13 6 905
15 3 18 14 9 10 5 12 1 2 16 4 7 13 17 15 782
4 17 6 10 1 222
8 4 15 8 13 14 1 18 11 449
12 4 3 17 13 2 9 ...

output:

976

result:

ok answer is '976'

Test #66:

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

input:

18 100
7 5 3 6 1 12 14 8 371
4 18 17 8 14 225
8 8 17 6 14 5 18 1 12 420
17 8 5 15 1 18 13 9 16 2 10 17 14 4 11 3 7 6 914
7 6 1 5 7 16 10 12 407
2 10 17 105
14 1 5 18 13 10 9 6 3 14 7 4 2 16 11 760
3 7 13 16 177
4 18 6 11 4 230
8 15 6 9 17 13 3 7 10 441
16 5 1 4 6 16 13 14 8 18 2 11 15 7 10 3 17 833
...

output:

-1

result:

ok answer is '-1'

Test #67:

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

input:

18 100
11 5 9 4 7 17 16 14 10 3 6 2 607
6 17 5 4 12 6 14 343
13 8 13 6 9 7 10 17 5 12 18 15 4 16 687
13 2 3 12 6 16 17 15 5 13 8 10 11 1 686
3 5 4 13 164
6 4 18 6 15 17 13 325
2 14 7 143
10 18 14 16 6 7 10 13 9 15 1 545
10 16 18 4 1 10 8 2 7 3 12 557
14 6 15 4 2 13 17 16 14 10 5 11 8 3 18 772
15 7 3...

output:

992

result:

ok answer is '992'

Test #68:

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

input:

18 100
15 5 4 6 12 2 18 16 3 7 15 10 1 13 11 9 822
7 7 1 9 11 12 8 6 400
9 14 6 15 16 9 12 7 10 17 503
2 4 17 155
4 13 8 9 4 256
8 9 13 1 5 8 3 15 6 427
2 3 16 132
2 6 3 126
9 4 17 3 7 14 8 16 1 5 514
16 12 7 1 18 9 15 6 10 16 17 4 2 11 3 14 13 881
15 3 11 18 7 1 4 13 16 17 5 8 14 12 6 2 807
12 16 1...

output:

1048

result:

ok answer is '1048'

Test #69:

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

input:

18 100
2 12 11 134
17 11 15 9 3 7 14 5 4 6 12 13 8 1 2 18 10 17 890
7 6 15 18 14 9 12 1 395
3 9 14 3 192
16 8 2 11 12 5 9 14 3 10 1 15 17 13 16 18 4 881
4 2 10 8 1 253
16 6 10 7 16 11 9 12 14 1 5 17 8 15 13 18 4 865
4 15 4 13 3 215
8 1 14 2 9 13 7 5 12 447
13 11 3 15 4 13 14 10 17 6 9 8 7 16 689
4 1...

output:

-1

result:

ok answer is '-1'

Test #70:

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

input:

18 100
2 12 17 154
6 10 12 11 7 3 15 315
11 15 3 16 13 10 12 14 1 7 17 9 592
17 5 3 16 10 7 4 9 18 17 8 14 11 2 1 13 12 15 905
13 6 15 2 14 13 10 12 1 9 4 17 8 7 725
3 13 16 15 167
4 1 18 8 12 247
12 11 5 2 10 12 7 3 16 15 13 4 17 654
10 2 14 15 1 11 5 8 7 17 4 526
6 7 15 3 17 9 16 312
17 3 7 1 5 17...

output:

-1

result:

ok answer is '-1'

Test #71:

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

input:

18 100
2 12 4 120
12 4 16 17 8 2 12 18 7 11 10 6 5 635
6 18 5 6 10 15 3 354
10 3 15 10 9 5 8 7 17 18 6 550
16 4 18 8 11 12 2 9 3 14 10 15 13 6 16 5 17 871
17 15 13 7 17 16 14 10 9 1 8 11 4 6 18 3 2 12 902
11 12 2 16 10 5 4 6 7 14 11 18 598
8 7 2 9 3 18 11 4 10 447
11 3 18 16 4 10 12 13 11 1 2 14 584...

output:

-1

result:

ok answer is '-1'

Test #72:

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

input:

18 100
3 7 18 3 167
14 13 9 10 8 4 17 3 7 1 11 5 2 14 15 773
2 16 11 132
14 8 17 1 13 12 16 5 9 15 7 4 18 11 2 733
4 7 12 17 16 235
13 6 18 13 7 15 17 12 4 1 10 8 9 2 717
9 11 1 17 4 13 10 2 18 7 504
13 13 6 4 7 3 8 5 9 14 10 11 1 15 722
5 17 5 14 11 4 268
17 14 13 17 12 3 18 1 7 5 2 10 11 15 9 4 6 ...

output:

-1

result:

ok answer is '-1'

Test #73:

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

input:

18 100
3 7 6 4 186
7 10 15 7 18 3 8 11 372
5 4 1 18 13 11 297
12 10 4 3 7 9 11 18 8 1 15 2 12 656
16 4 18 1 15 17 5 16 12 13 14 8 2 7 3 9 10 851
15 2 13 7 6 11 17 9 3 16 15 10 4 1 8 18 825
5 7 16 9 2 6 287
8 12 6 14 4 10 1 5 3 428
17 11 13 9 8 6 15 12 17 5 14 1 2 18 7 16 10 4 906
14 16 6 17 12 18 5 ...

output:

1008

result:

ok answer is '1008'

Test #74:

score: 0
Accepted
time: 21ms
memory: 4656kb

input:

17 100
3 12 15 14 213
2 13 1 161
2 16 14 149
2 11 8 153
3 15 9 16 205
2 5 10 158
2 5 2 142
3 7 15 16 184
2 1 9 149
3 5 1 17 177
2 7 2 143
3 16 8 10 174
2 3 8 150
2 3 11 157
3 2 14 12 215
2 4 8 127
2 15 5 138
3 13 7 2 168
3 8 13 10 205
3 6 5 15 200
2 3 4 126
3 12 16 7 213
3 14 9 12 171
2 4 14 156
2 1...

output:

1011

result:

ok answer is '1011'

Test #75:

score: 0
Accepted
time: 18ms
memory: 4644kb

input:

17 100
3 11 10 17 219
2 8 5 132
2 17 16 136
2 3 6 148
3 15 4 7 215
2 1 3 126
3 17 16 13 218
2 14 11 118
2 12 6 155
2 7 8 120
3 5 6 13 218
3 6 5 16 188
2 1 6 133
3 1 2 13 214
2 6 2 161
3 10 5 15 185
3 4 12 11 189
3 2 10 3 165
2 12 4 137
3 1 3 15 196
2 2 4 165
2 4 6 135
3 16 15 8 206
3 17 11 14 178
2 ...

output:

1010

result:

ok answer is '1010'

Test #76:

score: 0
Accepted
time: 18ms
memory: 4648kb

input:

17 100
3 10 14 3 192
3 5 8 9 166
3 1 12 6 167
2 3 10 146
3 15 11 3 186
2 13 15 156
3 10 3 14 208
3 8 6 1 215
3 16 6 8 174
3 14 6 15 218
3 3 11 13 202
2 13 14 148
3 2 16 3 213
3 6 2 9 175
3 8 3 17 174
3 2 7 8 216
2 12 16 164
3 2 15 17 197
3 3 6 17 208
3 7 16 3 211
3 1 17 8 177
2 15 17 134
3 2 13 4 16...

output:

1010

result:

ok answer is '1010'

Test #77:

score: 0
Accepted
time: 17ms
memory: 4728kb

input:

17 100
3 8 9 7 174
2 9 13 139
3 17 2 15 207
3 10 15 5 179
2 14 11 144
2 5 15 152
3 1 15 7 172
2 1 12 126
3 5 7 1 191
3 13 5 9 213
2 12 14 126
2 15 11 127
2 11 3 153
2 10 5 151
2 8 4 163
2 17 11 123
3 3 14 17 180
3 10 12 14 184
3 8 7 15 219
2 2 16 124
2 3 7 126
3 3 17 7 200
3 6 3 2 172
3 2 12 14 207
...

output:

995

result:

ok answer is '995'

Test #78:

score: 0
Accepted
time: 22ms
memory: 4724kb

input:

17 100
3 6 14 10 172
3 5 17 11 194
2 14 2 145
3 7 2 17 206
3 6 11 2 176
2 16 11 110
2 10 4 123
3 12 13 5 220
2 13 17 157
3 8 16 12 200
2 10 7 121
2 3 16 155
2 9 17 110
3 1 2 6 216
3 11 16 6 173
3 13 17 12 208
3 3 13 2 212
3 9 6 11 165
3 4 14 5 175
3 5 13 1 178
2 9 6 159
3 7 4 11 168
2 14 11 140
3 8 ...

output:

998

result:

ok answer is '998'

Test #79:

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

input:

18 100
3 1 5 11 179
3 9 10 18 182
3 11 14 8 205
3 18 8 14 194
3 17 11 14 197
3 1 10 5 202
3 13 7 12 205
3 8 9 18 199
3 13 11 17 170
3 10 18 14 197
3 18 14 4 190
3 4 13 7 207
3 9 18 12 181
3 9 1 11 172
3 3 7 13 190
3 6 16 15 193
3 7 1 4 156
3 10 13 11 204
3 13 10 6 168
3 14 10 16 164
3 5 17 16 162
3 ...

output:

988

result:

ok answer is '988'

Test #80:

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

input:

18 100
3 5 1 9 198
3 6 2 1 160
3 15 9 17 181
3 1 14 12 182
3 17 11 13 192
3 6 7 3 160
3 1 16 15 207
3 18 14 9 193
3 15 2 6 172
3 14 4 11 157
3 1 18 13 160
3 13 3 8 176
3 13 3 10 199
3 16 17 8 174
3 7 1 16 179
3 15 8 7 158
3 1 7 5 194
3 15 7 14 170
3 3 14 15 195
3 12 6 3 172
3 10 2 9 182
3 6 15 16 20...

output:

1004

result:

ok answer is '1004'

Test #81:

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

input:

18 100
3 2 7 8 183
3 16 17 5 206
3 7 14 4 165
3 7 14 10 202
3 8 11 10 159
3 16 17 11 172
3 13 6 10 183
3 9 7 12 184
3 8 6 13 204
3 4 9 18 195
3 13 18 1 191
3 2 4 17 187
3 9 2 1 195
3 17 13 7 206
3 12 8 14 200
3 9 12 3 161
3 8 11 9 175
3 2 1 16 208
3 6 11 9 159
3 5 14 15 185
3 14 16 1 201
3 12 18 11 ...

output:

982

result:

ok answer is '982'

Test #82:

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

input:

18 100
3 14 16 18 163
3 7 4 18 167
3 8 9 5 172
3 17 9 16 187
3 5 11 17 193
3 2 15 14 195
3 8 2 15 200
3 8 2 18 179
3 8 12 1 205
3 11 12 16 158
3 16 6 7 205
3 8 9 12 207
3 2 1 16 201
3 2 4 5 194
3 4 12 6 158
3 13 11 9 192
3 18 9 1 185
3 12 14 3 195
3 13 2 6 190
3 14 8 18 192
3 8 14 16 193
3 15 10 12 ...

output:

990

result:

ok answer is '990'

Test #83:

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

input:

18 100
3 11 3 5 183
3 9 5 8 164
3 8 2 13 184
3 7 1 5 206
3 3 6 5 158
3 4 9 2 190
3 8 4 5 191
3 4 11 2 199
3 14 3 6 161
3 14 9 12 179
3 3 18 15 182
3 3 18 12 162
3 4 3 16 171
3 7 14 11 164
3 2 7 12 192
3 14 1 3 157
3 2 9 15 161
3 14 6 16 208
3 5 4 15 158
3 15 2 4 162
3 1 6 7 183
3 6 18 3 185
3 12 11 ...

output:

990

result:

ok answer is '990'

Test #84:

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

input:

18 100
2 1 9 149
2 15 12 149
2 16 4 133
2 9 1 125
2 1 7 148
2 2 9 129
2 17 13 135
2 9 13 153
2 10 16 155
2 5 16 128
2 11 17 134
2 17 1 106
2 8 12 115
2 2 5 148
2 12 16 148
2 7 18 153
2 7 18 133
2 9 15 108
2 15 5 134
2 7 10 109
2 18 15 147
2 11 6 104
2 6 18 107
2 16 13 142
2 6 4 149
2 17 18 128
2 2 1...

output:

1017

result:

ok answer is '1017'

Test #85:

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

input:

18 100
2 2 11 135
2 10 15 154
2 6 18 137
2 18 8 110
2 17 5 155
2 8 14 116
2 14 2 125
2 5 1 110
2 14 4 125
2 15 16 145
2 10 5 109
2 10 16 147
2 15 5 115
2 15 5 114
2 8 11 118
2 2 14 129
2 5 4 150
2 7 16 146
2 14 18 125
2 8 11 126
2 15 1 150
2 12 18 150
2 17 1 152
2 13 6 104
2 10 6 151
2 18 5 113
2 1 ...

output:

997

result:

ok answer is '997'

Test #86:

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

input:

18 100
2 6 7 112
2 8 16 106
2 14 10 112
2 11 15 155
2 3 10 143
2 17 10 111
2 1 9 143
2 1 11 118
2 7 14 116
2 3 6 136
2 17 3 112
2 16 11 107
2 2 16 143
2 15 6 129
2 7 9 151
2 16 11 151
2 18 1 150
2 2 6 142
2 9 3 149
2 12 18 141
2 2 1 137
2 18 17 121
2 13 12 153
2 4 15 138
2 17 4 143
2 11 12 153
2 16 ...

output:

1005

result:

ok answer is '1005'

Test #87:

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

input:

18 100
2 6 12 132
2 9 6 111
2 5 13 135
2 18 4 142
2 6 12 125
2 8 9 117
2 10 9 117
2 18 15 134
2 5 1 142
2 4 6 121
2 9 8 139
2 15 4 114
2 16 3 145
2 12 9 128
2 17 11 129
2 12 13 155
2 5 15 132
2 1 2 120
2 3 10 117
2 3 18 144
2 9 15 119
2 17 18 104
2 14 11 154
2 15 2 124
2 6 12 152
2 12 6 127
2 17 3 1...

output:

1017

result:

ok answer is '1017'

Test #88:

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

input:

18 100
2 11 9 139
2 12 13 120
2 16 3 113
2 7 10 149
2 17 12 140
2 16 8 149
2 2 10 107
2 15 9 150
2 17 3 156
2 8 10 123
2 6 11 138
2 16 1 125
2 1 10 124
2 4 1 112
2 7 4 152
2 1 7 113
2 3 5 136
2 14 5 106
2 9 16 128
2 10 6 118
2 5 16 150
2 10 18 127
2 18 11 122
2 4 15 129
2 8 10 131
2 9 16 131
2 5 3 1...

output:

1013

result:

ok answer is '1013'

Test #89:

score: 0
Accepted
time: 38ms
memory: 4604kb

input:

18 100
2 7 11 114
3 8 4 7 158
2 4 3 149
3 8 14 3 177
2 15 7 137
3 3 8 10 172
2 15 5 111
3 7 10 16 195
2 10 1 112
3 9 2 3 162
2 17 13 106
3 6 1 2 187
2 5 7 111
3 6 14 7 196
3 11 5 12 207
2 10 13 151
2 17 14 152
2 13 3 116
3 8 17 9 168
3 1 2 7 195
2 3 2 130
2 8 14 152
2 17 8 112
3 13 5 12 187
2 10 3 1...

output:

986

result:

ok answer is '986'

Test #90:

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

input:

18 100
2 15 17 134
3 7 11 3 193
3 14 8 2 174
2 5 1 116
2 18 11 142
2 8 7 120
2 1 14 119
3 3 9 10 176
2 2 16 104
2 14 4 141
3 8 13 7 185
3 12 16 10 199
2 15 12 108
2 8 15 123
2 7 9 151
3 9 14 10 182
3 8 18 5 188
2 8 3 116
3 12 18 5 194
2 14 1 110
2 1 6 125
2 13 10 121
3 4 3 1 161
2 3 18 147
2 16 8 11...

output:

998

result:

ok answer is '998'

Test #91:

score: 0
Accepted
time: 27ms
memory: 4592kb

input:

18 100
2 16 4 131
3 12 8 13 185
3 17 11 14 170
3 2 9 11 170
3 6 17 12 178
2 13 16 136
2 4 12 104
3 12 7 6 203
2 7 4 134
2 5 1 155
3 11 7 3 190
3 1 9 4 166
2 13 12 130
3 17 18 8 169
3 9 14 6 192
3 7 8 2 182
3 4 1 2 183
3 1 9 2 185
2 13 14 146
3 6 8 5 167
3 10 15 4 197
2 11 12 109
2 1 6 153
2 14 9 153...

output:

995

result:

ok answer is '995'

Test #92:

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

input:

18 100
2 16 10 150
2 10 12 104
3 18 17 15 183
3 15 17 4 172
3 1 5 9 197
3 10 15 3 179
3 12 4 17 193
3 12 14 10 157
2 13 12 116
3 4 13 10 201
2 9 1 143
3 13 18 6 156
3 1 13 8 206
2 13 7 117
2 16 1 108
3 15 6 13 186
3 14 11 2 199
2 2 17 107
2 17 9 105
3 12 14 10 165
3 12 18 6 198
3 12 14 15 204
2 6 9 ...

output:

960

result:

ok answer is '960'

Test #93:

score: 0
Accepted
time: 47ms
memory: 4648kb

input:

18 100
2 5 2 137
3 11 8 15 190
2 11 3 121
3 5 13 9 195
2 4 5 119
2 17 1 105
2 15 3 143
3 1 12 13 184
3 16 3 9 189
3 2 13 18 200
2 5 4 148
2 6 14 105
2 14 3 120
3 13 18 16 160
2 16 14 139
3 12 17 5 176
2 6 15 122
2 6 16 116
2 3 15 126
2 5 9 125
3 5 13 3 156
3 6 4 11 203
3 3 16 1 159
2 5 16 153
3 17 5...

output:

989

result:

ok answer is '989'

Test #94:

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

input:

18 100
2 11 5 106
2 11 6 114
2 2 12 106
2 8 17 123
2 2 11 127
2 12 11 144
2 4 15 132
2 6 10 108
2 2 18 154
2 16 3 107
2 12 18 138
2 9 14 126
2 10 15 110
2 1 11 105
2 7 15 149
2 14 3 140
2 8 13 153
2 4 1 106
2 17 3 135
2 7 14 119
2 18 11 110
2 1 16 114
2 4 9 108
2 18 2 111
2 14 7 116
2 9 4 144
2 9 14...

output:

967

result:

ok answer is '967'

Test #95:

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

input:

18 100
2 12 10 136
2 15 7 130
2 14 8 111
2 13 6 150
2 12 9 134
2 4 16 150
2 15 6 112
2 14 6 143
2 18 5 117
2 3 11 142
2 7 17 126
2 11 16 136
2 18 11 127
2 15 18 125
2 6 1 134
2 7 4 120
2 3 15 114
2 12 10 148
2 9 14 154
2 4 1 144
2 9 14 118
2 16 2 120
2 12 16 145
2 6 1 156
2 12 7 130
2 5 11 149
2 8 1...

output:

1010

result:

ok answer is '1010'

Test #96:

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

input:

18 100
2 6 10 151
2 2 5 145
2 1 14 121
2 17 14 126
2 4 13 111
2 9 13 115
2 18 4 119
2 18 6 106
2 15 8 118
2 6 1 145
2 1 2 108
2 15 7 155
2 14 5 145
2 10 12 139
2 18 4 104
2 13 9 120
2 2 16 118
2 9 14 145
2 16 17 125
2 13 3 148
2 2 18 142
2 12 2 156
2 6 1 106
2 10 2 123
2 16 1 139
2 10 5 115
2 9 11 1...

output:

969

result:

ok answer is '969'

Test #97:

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

input:

18 100
2 2 16 153
2 9 8 140
2 9 3 154
2 16 12 129
2 2 9 151
2 13 17 129
2 15 8 140
2 17 8 114
2 5 11 130
2 17 9 150
2 14 13 137
2 8 3 147
2 13 3 141
2 10 11 109
2 7 16 138
2 6 3 134
2 18 17 135
2 12 13 137
2 14 10 144
2 10 16 126
2 4 3 143
2 14 1 148
2 17 8 110
2 18 4 108
2 7 18 127
2 1 6 147
2 17 1...

output:

1029

result:

ok answer is '1029'

Test #98:

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

input:

18 100
2 3 15 156
2 15 8 144
2 17 14 151
2 11 14 126
2 11 5 150
2 16 17 148
2 18 15 112
2 8 9 153
2 7 15 150
2 18 6 116
2 18 8 129
2 15 2 151
2 11 9 132
2 7 15 154
2 5 16 116
2 18 8 113
2 6 14 106
2 3 17 113
2 11 13 153
2 5 16 121
2 5 2 146
2 13 8 154
2 16 5 117
2 7 3 127
2 6 4 156
2 14 5 146
2 14 1...

output:

1052

result:

ok answer is '1052'

Test #99:

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

input:

18 100
2 7 17 139
2 13 12 150
2 12 8 152
2 4 18 130
2 11 9 122
2 10 11 130
2 2 5 145
2 9 10 148
2 5 8 132
2 9 10 136
2 15 5 106
2 13 18 147
2 9 1 151
2 16 15 108
2 13 8 153
2 16 8 117
2 1 13 115
2 11 16 147
2 1 4 151
2 9 6 126
2 10 16 136
2 3 10 111
2 13 10 132
2 8 10 129
2 14 12 131
2 13 12 155
2 1...

output:

985

result:

ok answer is '985'

Test #100:

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

input:

18 100
2 7 15 105
2 8 10 155
2 16 8 146
2 5 17 104
2 13 11 121
2 14 3 156
2 4 10 114
2 17 7 149
2 8 13 130
2 14 1 130
2 3 18 111
2 5 12 105
2 7 4 141
2 15 11 109
2 15 11 138
2 13 1 135
2 6 11 115
2 3 7 125
2 1 2 154
2 16 3 151
2 10 14 127
2 3 8 104
2 9 4 117
2 7 13 125
2 1 12 112
2 3 5 144
2 9 6 129...

output:

982

result:

ok answer is '982'

Test #101:

score: 0
Accepted
time: 67ms
memory: 4572kb

input:

18 100
1 6 100
1 10 78
1 16 57
1 1 97
1 4 83
1 11 59
1 17 91
1 3 53
1 1 80
1 1 104
1 17 83
1 9 59
1 9 56
1 9 69
1 10 53
1 1 64
1 8 102
1 14 94
1 5 89
1 18 97
1 12 72
1 15 56
1 15 84
1 6 67
1 13 76
1 7 68
1 5 95
1 15 90
1 8 72
1 9 69
1 6 103
1 6 84
1 9 84
1 3 96
1 5 73
1 8 65
1 7 58
1 10 68
1 11 79
1...

output:

1092

result:

ok answer is '1092'

Test #102:

score: 0
Accepted
time: 71ms
memory: 4644kb

input:

18 100
1 6 78
1 11 94
1 4 92
1 10 91
1 5 67
1 6 104
1 9 72
1 12 101
1 18 82
1 10 52
1 9 52
1 2 57
1 14 93
1 12 67
1 12 73
1 12 64
1 11 62
1 13 76
1 8 67
1 3 74
1 3 92
1 15 98
1 18 95
1 11 98
1 13 87
1 11 89
1 13 64
1 17 81
1 8 62
1 5 93
1 15 58
1 5 58
1 1 93
1 10 60
1 14 65
1 11 93
1 8 96
1 12 82
1 ...

output:

1063

result:

ok answer is '1063'

Test #103:

score: 0
Accepted
time: 74ms
memory: 4580kb

input:

18 100
1 11 74
1 3 69
1 18 84
1 6 77
1 6 74
1 10 74
1 8 65
1 17 54
1 2 72
1 12 63
1 12 97
1 3 73
1 15 56
1 3 87
1 1 75
1 16 75
1 14 57
1 15 56
1 14 98
1 10 60
1 4 81
1 10 65
1 4 87
1 2 66
1 9 75
1 13 57
1 13 79
1 16 83
1 16 85
1 5 76
1 11 59
1 13 52
1 2 102
1 9 77
1 15 77
1 6 91
1 5 69
1 4 86
1 11 6...

output:

1127

result:

ok answer is '1127'

Test #104:

score: 0
Accepted
time: 69ms
memory: 4648kb

input:

18 100
1 1 63
1 1 52
1 6 100
1 2 70
1 7 69
1 1 66
1 11 66
1 17 103
1 12 73
1 17 74
1 8 66
1 8 70
1 6 83
1 15 85
1 11 54
1 9 75
1 6 71
1 2 57
1 17 65
1 13 98
1 5 59
1 9 65
1 12 98
1 15 89
1 18 98
1 7 67
1 17 83
1 14 74
1 12 56
1 4 82
1 16 70
1 16 101
1 7 77
1 16 95
1 10 99
1 9 55
1 7 77
1 16 67
1 18 ...

output:

1100

result:

ok answer is '1100'

Test #105:

score: 0
Accepted
time: 78ms
memory: 4576kb

input:

18 100
1 2 71
1 6 80
1 16 81
1 15 86
1 13 76
1 1 77
1 18 100
1 8 75
1 10 63
1 1 67
1 18 88
1 5 86
1 11 67
1 6 71
1 4 74
1 13 75
1 9 95
1 1 70
1 5 96
1 2 75
1 10 101
1 8 65
1 12 90
1 2 56
1 18 56
1 6 88
1 7 63
1 17 84
1 16 99
1 4 54
1 2 89
1 1 75
1 12 97
1 5 89
1 1 92
1 7 83
1 4 61
1 1 81
1 11 65
1 1...

output:

1098

result:

ok answer is '1098'

Test #106:

score: 0
Accepted
time: 15ms
memory: 4632kb

input:

18 18
1 1 1000
1 2 1000
1 3 1000
1 4 1000
1 5 1000
1 6 1000
1 7 1000
1 8 1000
1 9 1000
1 10 1000
1 11 1000
1 12 1000
1 13 1000
1 14 1000
1 15 1000
1 16 1000
1 17 1000
1 18 1000

output:

18000

result:

ok answer is '18000'