QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#116087#5280. Depot Rearrangementznstz#100 ✓45ms31180kbC++142.1kb2023-06-28 09:12:582024-05-31 14:20:26

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 1ms
memory: 7428kb

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
19 21
11 19
18 11
7 18
14 7
6 14
17 6
3 17
13 3
2 13
9 2
1 9
21 1

result:

ok both subtasks are correct!

Test #3:

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

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
85 101
26 85
95 26
51 95
78 51
44 78
92 44
54 92
42 54
21 42
82 21
96 82
63 96
75 63
31 75
65 31
52 65
23 52
86 23
24 86
12 24
41 12
72 41
46 72
32 46
11 32
2 11
13 2
34 13
25 34
4 25
101 4

result:

ok both subtasks are correct!

Test #4:

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

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
451 1001
183 451
812 183
942 812
352 942
772 352
665 772
825 665
172 825
202 172
844 202
733 844
711 733
811 711
101 811
1001 101
746 1001
706 746
1001 706

result:

ok both subtasks are correct!

Test #5:

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

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
16148 20001
16830 16148
6329 16830
17201 6329
15517 17201
16308 15517
18908 16308
7034 18908
17734 7034
9974 17734
18894 9974
19114 18894
19632 19114
4443 19632
18934 4443
18766 18934
10366 18766
18441 10366
18071 18441
18471 18071
10476 18471
18476 10476
2841 18476
17217 2841
19501 17217
12729 ...

result:

ok both subtasks are correct!

Test #6:

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

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
3867 4021
4007 3867
3984 4007
4004 3984
3988 4004
3924 3988
3964 3924
3913 3964
3963 3913
3938 3963
3911 3938
3990 3911
3827 3990
3884 3827
3908 3884
3943 3908
3794 3943
3905 3794
3985 3905
3970 3985
3823 3970
3792 3823
3978 3792
3747 3978
3922 3747
3871 3922
3741 3871
3785 3741
3725 3785
3765 ...

result:

ok both subtasks are correct!

Test #7:

score: 5
Accepted
time: 15ms
memory: 10260kb

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
72627 90001
75609 72627
36905 75609
87605 36905
84677 87605
35604 84677
60536 35604
87053 60536
88566 87053
5704 88566
40289 5704
69707 40289
15407 69707
49635 15407
15435 49635
5789 15435
16204 5789
22204 16204
80115 22204
22215 80115
88504 22215
19866 88504
79950 19866
66319 79950
81319 66319
...

result:

ok both subtasks are correct!

Test #8:

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

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
12039 12041
11719 12039
11999 11719
11679 11999
11959 11679
11639 11959
11919 11639
11599 11919
11879 11599
11559 11879
11839 11559
11519 11839
11799 11519
11479 11799
12038 11479
11399 12038
11439 11399
11998 11439
11398 11998
11958 11398
11359 11958
11918 11359
11319 11918
11878 11319
11279 ...

result:

ok both subtasks are correct!

Test #9:

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

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
39631 40001
39958 39631
39522 39958
39952 39522
39626 39952
39365 39626
39797 39365
39227 39797
39934 39227
39156 39934
39415 39156
39230 39415
38962 39230
39770 38962
39552 39770
39611 39552
38524 39611
39918 38524
39421 39918
39020 39421
39928 39020
39037 39928
39843 39037
39007 39843
39736 ...

result:

ok both subtasks are correct!

Test #10:

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

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
5420 6401
5597 5420
6109 5597
6313 6109
5456 6313
5849 5456
6193 5849
4728 6193
5824 4728
4567 5824
5026 4567
2966 5026
5732 2966
5776 5732
4146 5776
5435 4146
3715 5435
5433 3715
6353 5433
5355 6353
2790 5355
4531 2790
4857 4531
5924 4857
4758 5924
3254 4758
5303 3254
4027 5303
4997 4027
5810 ...

result:

ok both subtasks are correct!

Test #11:

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

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
39742 40001
39832 39742
39706 39832
39902 39706
39647 39902
39911 39647
39714 39911
39624 39714
39939 39624
39709 39939
39992 39709
39560 39992
39639 39560
39205 39639
39627 39205
39916 39627
39349 39916
39537 39349
38920 39537
39519 38920
38587 39519
39514 38587
39932 39514
39637 39932
39354 ...

result:

ok both subtasks are correct!

Test #12:

score: 5
Accepted
time: 4ms
memory: 8432kb

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
6018 6021
5698 6018
5979 5698
5678 5979
5959 5678
5659 5959
5936 5659
5636 5936
5919 5636
5618 5919
5899 5618
5598 5899
5879 5598
5579 5879
5819 5579
5558 5819
5799 5558
5539 5799
5759 5539
5479 5759
6017 5479
5397 6017
5439 5397
5999 5439
5379 5999
5419 5379
5977 5419
5395 5977
5958 5395
5377 ...

result:

ok both subtasks are correct!

Test #13:

score: 5
Accepted
time: 21ms
memory: 15300kb

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
89463 90001
89203 89463
89789 89203
88669 89789
89823 88669
89642 89823
86504 89642
89449 86504
89834 89449
89254 89834
87828 89254
88114 87828
88682 88114
89492 88682
87992 89492
89412 87992
88874 89412
89622 88874
88628 89622
86421 88628
89238 86421
88626 89238
88312 88626
89546 88312
89812 ...

result:

ok both subtasks are correct!

Test #14:

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

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
80398 80401
79997 80398
79198 79997
79599 79198
78542 79599
79196 78542
79999 79196
78399 79999
79747 78399
80393 79747
78798 80393
79597 78798
78398 79597
79195 78398
80392 79195
77999 80392
79437 77999
79996 79437
78797 79996
80391 78797
79595 80391
78796 79595
77998 78796
79035 77998
78397 ...

result:

ok both subtasks are correct!

Test #15:

score: 5
Accepted
time: 26ms
memory: 12472kb

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
118632 160001
632 118632
160001 632
147420 160001
133336 147420
87309 133336
132079 87309
148530 132079
134834 148530
126834 134834
143634 126834
110034 143634
119730 110034
53830 119730
117030 53830
139314 117030
137965 139314
152514 137965
133714 152514
34012 133714
83046 34012
34246 83046
102...

result:

ok both subtasks are correct!

Test #16:

score: 5
Accepted
time: 18ms
memory: 12860kb

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
56991 60201
58273 56991
59788 58273
59540 59788
59772 59540
60143 59772
58972 60143
59761 58972
58762 59761
59317 58762
59968 59317
58255 59968
58962 58255
58128 58962
58948 58128
57153 58948
59058 57153
56506 59058
59752 56506
58370 59752
59346 58370
56004 59346
58033 56004
59014 58033
58336 ...

result:

ok both subtasks are correct!

Test #17:

score: 5
Accepted
time: 22ms
memory: 23512kb

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
80399 80401
79599 80399
78799 79599
79598 78799
79999 79598
80397 79999
78399 80397
79597 78399
80396 79597
79997 80396
78398 79997
78798 78398
80395 78798
79595 80395
79996 79595
79594 79996
78397 79594
80394 78397
77999 80394
80393 77999
77599 80393
80392 77599
77199 80392
80391 77199
76799 ...

result:

ok both subtasks are correct!

Test #18:

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

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
118579 120001
118231 118579
118924 118231
115845 118924
117726 115845
118581 117726
118085 118581
119525 118085
118262 119525
114522 118262
117168 114522
113529 117168
117032 113529
116334 117032
119796 116334
117140 119796
113112 117140
115710 113112
116771 115710
116258 116771
112383 116258
...

result:

ok both subtasks are correct!

Test #19:

score: 5
Accepted
time: 31ms
memory: 31180kb

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
132865 132868
131669 132865
132467 131669
132864 132467
132066 132864
132862 132066
131270 132862
132466 131270
131667 132466
132861 131667
130871 132861
132464 130871
130472 132464
132463 130472
131269 132463
131666 131269
132065 131666
131268 132065
132858 131268
130072 132858
132461 130072...

result:

ok both subtasks are correct!

Test #20:

score: 5
Accepted
time: 45ms
memory: 21432kb

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
153298 160001
159024 153298
159997 159024
157641 159997
158586 157641
159605 158586
158108 159605
158598 158108
158076 158598
159208 158076
155253 159208
156043 155253
158420 156043
154460 158420
159239 154460
154904 159239
156434 154904
158949 156434
159935 158949
156187 159935
155762 156187
...

result:

ok both subtasks are correct!