QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#141005#5280. Depot Rearrangementhyforces#100 ✓61ms33612kbC++142.2kb2023-08-17 05:38:572024-04-28 07:20:58

詳細信息

Test #1:

score: 5
Accepted
time: 2ms
memory: 8308kb

input:

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


output:

0

result:

ok both subtasks are correct!

Test #2:

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

input:

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


output:

13
4 21
8 4
12 8
3 12
15 3
2 15
20 2
7 20
19 7
14 19
10 14
18 10
21 18

result:

ok both subtasks are correct!

Test #3:

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

input:

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


output:

32
3 101
18 3
38 18
29 38
6 29
28 6
90 28
56 90
39 56
20 39
43 20
76 43
30 76
100 30
49 100
95 49
58 95
16 58
27 16
87 27
55 87
36 55
50 36
79 50
44 79
26 44
67 26
97 67
66 97
75 66
89 75
101 89

result:

ok both subtasks are correct!

Test #4:

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

input:

100 10
1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 9 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10...

output:

19
109 1001
453 109
184 453
734 184
713 734
819 713
210 819
830 210
175 830
775 175
670 775
850 670
814 850
359 814
949 359
1001 949
707 1001
747 707
1001 747

result:

ok both subtasks are correct!

Test #5:

score: 5
Accepted
time: 5ms
memory: 8600kb

input:

200 100
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

195
273 20001
5773 273
6579 5773
17199 6579
8977 17199
5861 8977
3761 5861
4233 3761
11277 4233
19198 11277
7667 19198
2067 7667
16367 2067
12753 16367
6330 12753
12730 6330
7953 12730
13453 7953
19380 13453
13480 19380
11653 13480
18966 11653
16366 18966
13167 16366
6867 13167
5967 6867
14925 5967
...

result:

ok both subtasks are correct!

Test #6:

score: 5
Accepted
time: 2ms
memory: 8932kb

input:

201 20
20 18 5 5 1 7 8 17 12 10 20 12 13 19 16 2 9 8 20 20 19 10 17 20 9 11 15 17 9 2 3 4 17 10 7 20 7 19 17 11 20 2 1 13 11 9 11 6 10 8 11 3 2 16 9 15 16 12 13 6 5 13 4 13 3 8 20 18 10 3 14 1 11 20 17 17 2 11 20 1 4 10 3 3 9 13 7 10 19 16 14 16 9 19 14 15 12 9 20 12 2 19 18 2 7 7 2 12 10 8 20 18 16...

output:

1401
20 4021
70 20
60 70
140 60
80 140
37 80
155 37
84 155
144 84
18 144
239 18
119 239
231 119
12 231
153 12
40 153
4 40
51 4
149 51
59 149
106 59
255 106
129 255
150 129
95 150
53 95
340 53
107 340
178 107
258 178
29 258
269 29
358 269
104 358
64 104
55 64
39 55
180 39
296 180
280 296
331 280
313 ...

result:

ok both subtasks are correct!

Test #7:

score: 5
Accepted
time: 16ms
memory: 11384kb

input:

300 300
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

205
1262 90001
72662 1262
75733 72662
72733 75733
11820 72733
72720 11820
81662 72720
44971 81662
53371 44971
26373 53371
16773 26373
17623 16773
80623 17623
65885 80623
58459 65885
3259 58459
77959 3259
20359 77959
21859 20359
65959 21859
16685 65959
30110 16685
15410 30110
49695 15410
15495 49695
...

result:

ok both subtasks are correct!

Test #8:

score: 5
Accepted
time: 11ms
memory: 10688kb

input:

301 40
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

11624
40 12041
320 40
640 320
39 640
639 39
920 639
38 920
919 38
319 919
918 319
1240 918
37 1240
1239 37
318 1239
1238 318
638 1238
1237 638
1520 1237
36 1520
1519 36
317 1519
1518 317
637 1518
1517 637
917 1517
1516 917
1840 1516
35 1840
1839 35
316 1839
1838 316
636 1838
1837 636
916 1837
1836 9...

result:

ok both subtasks are correct!

Test #9:

score: 5
Accepted
time: 16ms
memory: 11904kb

input:

400 100
11 65 1 79 15 18 79 46 9 30 71 53 58 55 94 73 39 16 6 91 49 30 23 30 28 81 90 48 97 54 79 30 94 18 42 77 44 36 5 48 55 97 79 36 41 59 79 71 32 59 3 10 63 52 44 41 9 46 31 31 56 87 60 80 12 51 15 78 41 65 95 34 29 83 46 64 37 53 98 17 41 45 36 73 20 53 48 80 57 54 57 72 39 56 98 6 10 78 11 72...

output:

14592
95 40001
196 95
900 196
96 900
600 96
1593 600
249 1593
57 249
395 57
1571 395
777 1571
2037 777
740 2037
2388 740
3285 2388
242 3285
97 242
281 97
482 281
381 482
2362 381
287 2362
158 287
400 158
489 400
888 489
99 888
1193 99
345 1193
480 345
889 480
1369 889
337 1369
163 337
1066 163
3436 ...

result:

ok both subtasks are correct!

Test #10:

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

input:

40 160
17 2 3 4 5 6 7 91 9 10 154 12 103 14 15 16 17 25 19 58 21 8 23 24 52 26 27 58 120 105 50 55 104 32 35 36 37 38 45 10 41 42 43 44 45 71 47 48 49 34 140 52 53 54 115 44 28 58 59 60 61 62 63 64 132 66 67 68 69 70 71 69 24 74 75 76 77 133 79 80 81 82 100 84 31 86 87 88 100 90 91 92 93 94 95 96 97...

output:

1316
153 6401
510 153
750 510
2337 750
1581 2337
2805 1581
1428 2805
1560 1428
534 1560
40 534
338 40
137 338
757 137
1485 757
839 1485
2906 839
2873 2906
2065 2873
806 2065
1366 806
1631 1366
3835 1631
2009 3835
938 2009
182 938
3804 182
17 3804
1876 17
3750 1876
2308 3750
2819 2308
3453 2819
2417 ...

result:

ok both subtasks are correct!

Test #11:

score: 5
Accepted
time: 16ms
memory: 11888kb

input:

400 100
88 82 9 2 90 1 83 32 32 79 8 79 63 67 85 82 50 63 69 2 7 91 21 90 69 3 39 78 66 83 96 53 24 65 56 63 90 54 35 55 94 22 76 12 54 55 5 49 91 73 8 19 64 54 39 23 13 27 34 4 81 52 13 11 36 45 3 50 82 81 42 50 75 15 99 70 29 26 70 66 34 15 42 83 16 19 19 12 76 1 68 49 7 17 64 37 98 34 99 37 34 64...

output:

14611
99 40001
495 99
20 495
763 20
90 763
996 90
170 996
577 170
67 577
311 67
987 311
51 987
643 51
592 643
159 592
953 159
595 953
483 595
659 483
532 659
1274 532
1097 1274
690 1097
988 690
397 988
1362 397
253 1362
949 253
63 949
132 63
955 132
264 955
1825 264
558 1825
93 558
134 93
1298 134
9...

result:

ok both subtasks are correct!

Test #12:

score: 5
Accepted
time: 8ms
memory: 9236kb

input:

301 20
8 1 1 1 1 1 1 17 1 9 1 5 1 1 1 1 13 1 9 1 18 1 1 16 1 15 5 19 1 8 11 10 1 1 1 1 18 4 1 1 1 1 16 1 1 1 12 10 1 1 1 14 11 13 1 1 1 1 1 1 10 1 1 1 1 1 1 19 14 1 1 1 5 1 1 1 1 13 1 18 1 1 4 1 1 1 1 1 1 1 1 1 1 16 16 10 1 14 18 1 1 1 7 1 1 1 1 6 9 1 13 1 1 1 2 1 1 1 1 1 1 10 1 1 1 17 1 10 10 1 12 ...

output:

4260
20 6021
239 20
545 239
18 545
619 18
16 619
678 16
15 678
1435 15
14 1435
852 14
13 852
129 13
317 129
618 317
920 618
11 920
440 11
9 440
359 9
7 359
230 7
919 230
598 919
617 598
789 617
6 789
1760 6
5 1760
95 5
315 95
1520 315
4 1520
37 4
314 37
1820 314
312 1820
174 312
311 174
19 311
843 1...

result:

ok both subtasks are correct!

Test #13:

score: 5
Accepted
time: 30ms
memory: 16304kb

input:

300 300
215 159 263 206 201 183 286 56 142 10 231 214 34 54 263 250 169 208 239 148 104 22 244 17 74 68 184 52 2 30 42 83 222 106 25 152 37 225 213 213 69 273 91 221 207 48 166 28 221 50 46 64 10 254 207 109 206 144 270 291 195 197 253 235 141 186 102 68 52 24 38 6 181 44 256 200 77 233 285 163 223 ...

output:

32648
187 90001
1094 187
2020 1094
3698 2020
597 3698
1014 597
4750 1014
100 4750
1955 100
231 1955
2183 231
4748 2183
218 4748
1121 218
53 1121
1710 53
3454 1710
4975 3454
1896 4975
3228 1896
974 3228
3809 974
2932 3809
5950 2932
5337 5950
6676 5337
3211 6676
4190 3211
6620 4190
2267 6620
5664 2267...

result:

ok both subtasks are correct!

Test #14:

score: 5
Accepted
time: 38ms
memory: 21972kb

input:

201 400
1 1 1 1 1 152 1 1 1 1 1 1 1 33 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 300 154 1 1 147 1 1 1 383 186 1 1 90 256 1 1 1 1 1 1 1 63 1 1 1 1 208 1 1 1 1 31 1 1 1 1 1 1 1 127 1 1 29 216 397 393 1 1 1 1 1 1 279 1 1 1 1 55 1 1 215 249 1 1 1 1 1 1 172 1 1 1 1 1 1 1 1 1 1 1 1 349 1 331 1 1 1 1 1 1 1 34...

output:

63990
397 80401
689 397
201 689
800 201
1004 800
200 1004
1003 200
603 1003
1406 603
199 1406
1405 199
396 1405
1600 396
602 1600
1599 602
799 1599
1809 799
197 1809
1808 197
395 1808
2000 395
599 2000
1999 599
797 1999
2211 797
196 2211
2209 196
394 2209
2400 394
598 2400
2399 598
796 2399
2612 796...

result:

ok both subtasks are correct!

Test #15:

score: 5
Accepted
time: 23ms
memory: 13932kb

input:

400 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

217
784 160001
118784 784
160001 118784
3172 160001
11722 3172
2922 11722
147572 2922
133420 147572
87336 133420
132109 87336
12909 132109
49143 12909
95543 49143
98343 95543
148343 98343
112743 148343
52743 112743
29909 52743
42309 29909
40709 42309
87909 40709
39109 87909
55390 39109
38990 55390
1...

result:

ok both subtasks are correct!

Test #16:

score: 5
Accepted
time: 24ms
memory: 14120kb

input:

301 200
50 129 146 60 183 51 47 77 26 73 1 45 1 44 149 1 81 196 17 16 163 35 159 71 1 94 161 138 138 27 76 1 102 42 5 186 176 1 111 198 37 63 81 155 95 164 132 135 155 194 126 98 31 34 121 19 175 148 33 105 25 122 91 165 1 69 1 197 12 98 1 155 5 53 42 1 60 98 78 61 155 13 1 171 102 152 95 61 87 200 ...

output:

23506
185 60201
532 185
165 532
505 165
73 505
528 73
1356 528
134 1356
875 134
518 875
325 518
793 325
109 793
888 109
221 888
988 221
106 988
471 106
200 471
384 200
702 384
1090 702
1778 1090
396 1778
187 396
728 187
1987 728
766 1987
2194 766
759 2194
316 759
706 316
94 706
780 94
276 780
1147 2...

result:

ok both subtasks are correct!

Test #17:

score: 5
Accepted
time: 27ms
memory: 24276kb

input:

201 400
1 1 1 1 1 1 1 1 1 1 1 1 1 263 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 246 1 1 1 1 1 1 1 1 1 1 1 1 1 1 107 1 1 1 1 1 1 1 1 57 1 1 1 1 1 1 1 224 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 90 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

77869
201 80401
800 201
1200 800
200 1200
1005 200
400 1005
1199 400
603 1199
1407 603
199 1407
1406 199
399 1406
1600 399
602 1600
1599 602
799 1599
1809 799
198 1809
1808 198
398 1808
2000 398
601 2000
1999 601
798 1999
2211 798
197 2211
2210 197
397 2210
2400 397
600 2400
2399 600
797 2399
2613 7...

result:

ok both subtasks are correct!

Test #18:

score: 5
Accepted
time: 61ms
memory: 19524kb

input:

400 300
75 26 289 176 131 196 124 8 230 157 247 265 13 2 210 141 17 200 187 83 21 22 118 144 232 26 284 75 48 30 132 32 65 34 72 36 73 286 164 40 41 261 65 270 221 12 139 48 49 143 91 39 17 258 275 56 151 194 282 55 228 266 296 64 22 232 67 142 69 152 10 102 109 45 75 49 283 112 78 283 81 236 169 22...

output:

43105
287 120001
1139 287
775 1139
253 775
4679 253
427 4679
1006 427
4766 1006
1692 4766
5011 1692
124 5011
392 124
690 392
243 690
2390 243
2450 2390
6592 2450
5395 6592
4136 5395
8696 4136
2215 8696
8546 2215
5643 8546
2642 5643
873 2642
600 873
9516 600
2865 9516
9717 2865
3543 9717
4726 3543
42...

result:

ok both subtasks are correct!

Test #19:

score: 5
Accepted
time: 39ms
memory: 33612kb

input:

333 399
1 1 1 1 1 1 1 28 1 1 1 1 1 1 161 1 17 1 1 1 1 262 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 43 1 1 1 1 1 70 1 1 1 142 1 1 1 1 1 1 1 1 1 1 1 1 70 1 1 1 1 1 1 278 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 245 1 1 1 1 1 1 33 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 106 1 1 1 1 268 1 1 1 172 1 1 1 1 1 312 1 286 1 1 1 1 ...

output:

114795
333 132868
1197 333
399 1197
1596 399
332 1596
1994 332
330 1994
2331 330
329 2331
2393 329
398 2393
2793 398
327 2793
3192 327
325 3192
3591 325
324 3591
3990 324
323 3990
4329 323
322 4329
4389 322
396 4389
4788 396
321 4788
5186 321
320 5186
5985 320
319 5985
6384 319
395 6384
6783 395
318...

result:

ok both subtasks are correct!

Test #20:

score: 5
Accepted
time: 61ms
memory: 23624kb

input:

400 400
100 35 353 385 317 228 7 148 113 165 11 306 209 89 21 166 17 2 19 249 27 305 377 22 3 353 38 28 29 96 191 32 33 309 35 308 100 176 152 40 176 42 43 86 45 46 96 48 396 381 218 246 53 54 334 159 243 360 294 60 33 62 185 64 65 66 191 121 351 107 10 343 367 74 75 201 77 247 79 134 304 92 42 126 ...

output:

55816
397 160001
1074 397
287 1074
546 287
1984 546
391 1984
1580 391
1033 1580
323 1033
496 323
147 496
2356 147
1162 2356
3547 1162
920 3547
94 920
3926 94
3365 3926
776 3365
1228 776
569 1228
4567 569
4380 4567
2388 4380
7049 2388
2738 7049
5423 2738
2676 5423
1901 2676
2670 1901
690 2670
328 690...

result:

ok both subtasks are correct!