QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#116260#5280. Depot Rearrangementtemplate#100 ✓146ms35732kbC++234.3kb2023-06-28 12:46:452024-05-31 18:26:03

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 2ms
memory: 9992kb

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
21 2
2 12
12 18
18 14
14 7
7 15
15 3
3 8
8 19
19 10
10 4
4 20
20 21

result:

ok both subtasks are correct!

Test #3:

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

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
101 95
95 55
55 79
79 89
89 26
26 58
58 16
16 3
3 36
36 44
44 27
27 100
100 87
87 97
97 28
28 90
90 30
30 50
50 39
39 20
20 38
38 56
56 66
66 75
75 18
18 43
43 76
76 67
67 29
29 6
6 49
49 101

result:

ok both subtasks are correct!

Test #4:

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

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
1001 707
707 747
747 1001
1001 359
359 775
775 175
175 210
210 830
830 670
670 850
850 814
814 109
109 453
453 184
184 734
734 713
713 819
819 949
949 1001

result:

ok both subtasks are correct!

Test #5:

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

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
20001 1178
1178 9278
9278 20001
20001 19182
19182 8598
8598 9190
9190 8590
8590 6084
6084 11861
11861 8849
8849 475
475 1541
1541 17469
17469 1569
1569 2866
2866 16366
16366 18966
18966 7068
7068 18968
18968 18781
18781 10381
10381 7854
7854 459
459 3259
3259 1459
1459 10488
10488 18488
18488 18...

result:

ok both subtasks are correct!

Test #6:

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

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
4021 3872
3872 4015
4015 3994
3994 4020
4020 3992
3992 3871
3871 3817
3817 3832
3832 3913
3913 3957
3957 3794
3794 3674
3674 3898
3898 3932
3932 3977
3977 3835
3835 3798
3798 3749
3749 3608
3608 3785
3785 3678
3678 3808
3808 514
514 1057
1057 1305
1305 1446
1446 1955
1955 1658
1658 1794
1794 19...

result:

ok both subtasks are correct!

Test #7:

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

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
90001 5151
5151 41751
41751 90001
90001 45855
45855 47655
47655 90001
90001 28482
28482 57282
57282 90001
90001 30900
30900 59100
59100 90001
90001 34753
34753 64753
64753 90001
90001 59621
59621 83621
83621 90001
90001 31298
31298 74498
74498 28103
28103 8603
8603 27413
27413 84877
84877 35684
...

result:

ok both subtasks are correct!

Test #8:

score: 5
Accepted
time: 13ms
memory: 12476kb

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
12041 9482
9482 11042
11042 7762
7762 11603
11603 8684
8684 10723
10723 3842
3842 11802
11802 1762
1762 604
604 7226
7226 1042
1042 3614
3614 7882
7882 7682
7682 3162
3162 11482
11482 4162
4162 10002
10002 3522
3522 8482
8482 3482
3482 8483
8483 2283
2283 6042
6042 3722
3722 7282
7282 10082
10...

result:

ok both subtasks are correct!

Test #9:

score: 5
Accepted
time: 41ms
memory: 16740kb

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
40001 39022
39022 38398
38398 38716
38716 39037
39037 39365
39365 38174
38174 38565
38565 36634
36634 37282
37282 38155
38155 36559
36559 36157
36157 33311
33311 31939
31939 32967
32967 36255
36255 37760
37760 38387
38387 36917
36917 35052
35052 35952
35952 33375
33375 34068
34068 32855
32855 ...

result:

ok both subtasks are correct!

Test #10:

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

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
6401 4636
4636 5435
5435 3836
3836 1419
1419 2868
2868 2078
2078 4561
4561 5598
5598 6238
6238 6400
6400 5465
5465 3752
3752 5119
5119 5920
5920 4319
4319 3199
3199 3670
3670 3198
3198 4479
4479 3824
3824 2715
2715 4312
4312 3360
3360 2025
2025 1760
1760 1596
1596 2714
2714 3668
3668 2966
2966 ...

result:

ok both subtasks are correct!

Test #11:

score: 5
Accepted
time: 36ms
memory: 16732kb

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
40001 39390
39390 39995
39995 39795
39795 39936
39936 39566
39566 39467
39467 39142
39142 39873
39873 39956
39956 39657
39657 39724
39724 39665
39665 39266
39266 39639
39639 39368
39368 38588
38588 37713
37713 36276
36276 35630
35630 33686
33686 33442
33442 33798
33798 28327
28327 29037
29037 ...

result:

ok both subtasks are correct!

Test #12:

score: 5
Accepted
time: 3ms
memory: 12320kb

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
6021 2584
2584 5222
5222 262
262 908
908 1222
1222 4564
4564 563
563 5124
5124 1442
1442 440
440 2711
2711 723
723 3922
3922 1082
1082 1542
1542 3063
3063 4962
4962 5962
5962 5704
5704 4182
4182 3205
3205 2242
2242 464
464 622
622 3
3 1169
1169 42
42 37
37 19
19 95
95 1571
1571 63
63 1195
1195 ...

result:

ok both subtasks are correct!

Test #13:

score: 5
Accepted
time: 71ms
memory: 20048kb

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
90001 87112
87112 88478
88478 85625
85625 88738
88738 89398
89398 89986
89986 87550
87550 88785
88785 89593
89593 89998
89998 89694
89694 89912
89912 89691
89691 89906
89906 89254
89254 87894
87894 88198
88198 89492
89492 89370
89370 87799
87799 89562
89562 89080
89080 89364
89364 88628
88628 ...

result:

ok both subtasks are correct!

Test #14:

score: 5
Accepted
time: 49ms
memory: 23996kb

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
80401 400
400 999
999 379
379 626
626 267
267 967
967 125
125 677
677 307
307 2301
2301 70032
70032 380
380 730
730 51980
51980 390
390 600
600 41886
41886 398
398 1784
1784 30197
30197 384
384 702
702 39804
39804 177
177 1324
1324 36134
36134 257
257 10937
10937 391
391 2210
2210 1592
1592 73...

result:

ok both subtasks are correct!

Test #15:

score: 5
Accepted
time: 9ms
memory: 20800kb

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
160001 17152
17152 22752
22752 160001
160001 29150
29150 18968
18968 28968
28968 50350
50350 160001
160001 41784
41784 35580
35580 77043
77043 35443
35443 41980
41980 58584
58584 160001
160001 37405
37405 63805
63805 160001
160001 22327
22327 68727
68727 160001
160001 19266
19266 72066
72066 160...

result:

ok both subtasks are correct!

Test #16:

score: 5
Accepted
time: 40ms
memory: 18364kb

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
60201 789
789 2791
2791 5162
5162 4596
4596 1874
1874 4560
4560 3675
3675 7546
7546 8583
8583 9732
9732 10914
10914 9513
9513 8508
8508 12495
12495 13674
13674 23708
23708 28123
28123 37985
37985 50487
50487 416
416 1760
1760 4522
4522 5324
5324 5158
5158 7161
7161 5507
5507 3148
3148 5975
597...

result:

ok both subtasks are correct!

Test #17:

score: 5
Accepted
time: 53ms
memory: 27312kb

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
80401 49850
49850 55076
55076 12665
12665 73971
73971 3017
3017 78793
78793 605
605 39599
39599 20303
20303 70352
70352 5027
5027 37188
37188 21509
21509 69548
69548 5831
5831 77186
77186 1409
1409 79598
79598 204
204 80000
80000 80201
80201 79799
79799 203
203 33171
33171 23519
23519 68744
68...

result:

ok both subtasks are correct!

Test #18:

score: 5
Accepted
time: 108ms
memory: 25220kb

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
120001 118794
118794 113927
113927 110983
110983 105900
105900 103458
103458 91079
91079 99299
99299 103467
103467 107680
107680 103378
103378 107697
107697 101100
101100 96500
96500 86100
86100 89890
89890 98657
98657 103194
103194 106106
106106 95332
95332 92034
92034 79500
79500 79744
79744...

result:

ok both subtasks are correct!

Test #19:

score: 5
Accepted
time: 102ms
memory: 35732kb

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
132868 89912
89912 115886
115886 71930
71930 99569
99569 365
365 46495
46495 281
281 36219
36219 65
65 593
593 12608
12608 335
335 1021
1021 12142
12142 336
336 1412
1412 556
556 3964
3964 126247
126247 11657
11657 337
337 2467
2467 11381
11381 338
338 10666
10666 339
339 9672
9672 340
340 94...

result:

ok both subtasks are correct!

Test #20:

score: 5
Accepted
time: 146ms
memory: 29344kb

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
160001 157793
157793 153428
153428 155146
155146 147979
147979 138760
138760 129177
129177 131521
131521 137592
137592 137997
137997 132732
132732 147177
147177 133584
133584 128629
128629 111286
111286 101197
101197 109600
109600 97728
97728 87584
87584 81271
81271 82295
82295 83177
83177 852...

result:

ok both subtasks are correct!