QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#418022#8567. Cheap ConstructionZhangYiDeAC ✓895ms52680kbC++141.4kb2024-05-23 09:24:382024-05-23 09:24:40

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 14244kb

input:

1
3
1 1
2 2
1 3

output:

1 1
1 3
3 2

result:

ok 3 lines

Test #2:

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

input:

2
3
1 1
1 2
3 1
3
1 3
2 1
3 3

output:

1 1
1 1
1 2
1 1
1 3
3 3

result:

ok 6 lines

Test #3:

score: 0
Accepted
time: 214ms
memory: 14244kb

input:

1000
500
1 25
2 115
2 356
4 396
5 417
3 416
1 376
8 302
5 475
8 134
5 470
2 191
9 443
9 483
7 311
6 415
14 422
6 288
9 411
9 318
18 406
20 213
16 292
8 351
8 150
20 199
3 311
22 321
22 221
16 364
7 316
17 79
23 160
23 369
6 209
36 9
35 490
2 498
30 391
31 175
10 322
16 484
4 63
44 304
39 300
13 309
...

output:

1 2
1 2
1 40
1 68
3 65
3 86
5 68
5 301
5 376
5 459
8 498
10 81
10 102
10 258
12 180
13 474
14 482
17 6
17 6
17 6
17 6
17 15
17 15
18 108
18 229
20 197
21 466
23 48
23 57
23 227
23 252
23 393
25 382
27 267
29 58
29 66
30 168
30 191
30 252
31 263
31 432
33 375
35 242
36 275
36 400
39 393
41 368
43 55
...

result:

ok 500000 lines

Test #4:

score: 0
Accepted
time: 202ms
memory: 14240kb

input:

1000
500
1 73
1 297
1 133
3 384
5 303
1 456
7 14
3 220
1 225
6 387
6 248
11 74
8 459
4 344
11 181
16 493
14 58
7 492
5 486
6 225
3 20
1 167
11 375
4 95
22 13
2 455
14 335
18 260
3 46
11 373
19 433
8 61
7 321
14 197
5 47
13 295
6 206
19 428
15 474
28 183
26 482
22 308
33 235
24 247
39 119
5 426
44 15...

output:

1 3
1 3
1 3
1 3
1 26
1 46
1 100
1 156
1 220
1 278
2 345
4 444
7 112
8 140
8 142
8 167
8 202
9 266
9 363
9 368
12 347
15 248
15 344
16 457
18 455
19 457
22 137
22 206
24 170
25 176
25 253
25 461
28 225
28 264
31 100
31 181
31 211
33 268
34 293
36 251
36 257
37 312
39 259
41 217
43 4
43 4
43 88
43 383...

result:

ok 500000 lines

Test #5:

score: 0
Accepted
time: 281ms
memory: 14148kb

input:

100
5000
1 2671
1 1099
3 2196
1 1009
2 297
3 3844
6 401
2 3199
8 1568
3 1435
6 2257
7 4299
5 2315
12 1425
6 1279
11 527
11 100
12 1495
13 2892
17 4548
16 348
10 4847
19 4320
24 2610
20 468
24 320
2 1764
4 307
20 1045
19 797
17 2185
25 4368
28 1560
29 1366
7 3490
2 3177
16 3805
33 1092
32 2461
7 1624...

output:

1 1
1 1
1 4
1 70
1 98
1 141
1 246
1 424
1 540
1 2075
1 3886
3 3267
5 577
5 1244
6 3014
8 1373
8 1414
8 1974
10 1599
10 2841
11 3104
12 3957
13 4824
13 4832
16 2416
16 4830
20 433
20 2022
20 3135
21 3843
21 4098
21 4157
25 2344
26 3672
29 928
29 1009
29 1089
29 1276
30 1755
30 4833
32 2242
33 3330
34...

result:

ok 500000 lines

Test #6:

score: 0
Accepted
time: 419ms
memory: 12260kb

input:

50
10000
1 7404
1 7552
3 4284
1 1500
5 1792
5 9068
4 8275
8 2357
7 469
10 3006
10 1191
6 8805
6 2704
2 2505
12 1435
16 4993
13 6359
9 9779
12 7254
15 9694
6 6990
9 6849
22 8155
4 4241
10 5531
22 6487
27 368
20 1664
13 5218
25 6795
23 8778
20 4142
4 8584
4 8738
24 9167
22 706
17 1860
23 96
23 8338
1 ...

output:

1 1
1 8
1 9
1 15
1 54
1 73
1 163
1 1332
1 1704
1 3089
1 3943
1 4310
3 7827
5 3956
6 4384
9 1791
9 3853
9 8926
10 9723
12 3940
12 6230
12 7278
15 5840
17 5623
19 327
19 518
19 682
19 3472
21 7173
23 733
23 1393
23 1825
24 6029
24 7361
24 7568
25 8146
25 8171
28 9323
31 2016
31 3460
31 4840
32 5262
34...

result:

ok 500000 lines

Test #7:

score: 0
Accepted
time: 315ms
memory: 12360kb

input:

50
10000
1 6249
2 7029
2 357
4 5488
5 8678
4 6108
4 7813
3 274
1 8027
8 9951
1 8969
3 484
1 1424
7 7366
15 8602
10 5263
12 9791
17 7083
14 4625
12 4396
7 5105
16 4007
6 1943
7 8485
24 1293
8 5539
5 9189
8 8898
23 1839
20 7303
4 9396
11 4124
17 9950
19 2158
15 6493
30 7789
31 7075
8 8527
30 8921
38 8...

output:

1 2
1 2
1 4
1 13
1 18
1 26
1 59
1 1444
1 7473
2 7688
4 3355
5 7257
7 74
7 160
7 551
7 581
7 2095
7 2096
7 4395
8 6351
8 8765
11 2704
11 8388
12 8787
14 3874
14 7481
18 856
18 2742
19 3115
19 7339
21 3362
21 3378
23 3365
23 3457
23 4182
23 6319
24 6972
25 8496
27 5518
30 4197
30 6809
31 8946
33 7183
...

result:

ok 500000 lines

Test #8:

score: 0
Accepted
time: 358ms
memory: 12428kb

input:

20
25000
1 14368
1 2826
3 9715
3 21430
3 11764
3 18927
4 717
4 7994
8 714
3 20485
4 284
9 4884
3 1481
7 3493
8 13233
16 10004
9 14771
8 2152
3 21774
5 15884
7 23464
3 5911
10 4643
15 23716
24 15579
13 9227
20 6401
18 5182
11 10155
21 2709
6 17801
2 7562
28 1618
29 10438
29 19637
26 8946
1 24856
24 2...

output:

1 1
1 1
1 11
1 30
1 36
1 74
1 3399
1 3871
1 18960
1 24862
4 6535
4 12331
6 8818
7 19408
9 13481
9 14168
9 16179
13 86
13 89
13 98
13 459
13 7807
13 14615
13 18972
15 22440
17 20692
19 4989
19 5041
19 16776
21 7249
21 16340
21 20637
24 7384
25 10163
26 10477
26 22767
28 21458
30 7073
30 7193
30 7831
...

result:

ok 500000 lines

Test #9:

score: 0
Accepted
time: 383ms
memory: 14840kb

input:

10
50000
1 40899
1 19858
2 37315
4 42990
4 42688
1 26367
2 3168
5 44653
8 26177
3 48486
7 20434
1 38766
5 32760
2 39034
13 42875
11 17508
15 41766
17 44586
1 2602
6 46879
16 3259
9 41465
9 8482
24 8129
22 32793
15 18406
18 30914
13 6106
8 17153
4 18147
7 46909
19 140
33 26355
34 42241
25 37395
11 46...

output:

1 1
1 1
1 3
1 6
1 9
1 19
1 23
1 25
1 29
1 55
1 65
1 2285
1 41147
3 3925
3 3972
3 7107
3 8573
3 8876
3 11260
3 33245
3 33479
5 36962
7 35348
7 37973
10 12203
12 30296
13 45376
13 48426
18 29311
20 163
20 326
20 666
20 746
20 8616
20 13582
21 20683
23 16518
25 5337
25 13147
25 18494
26 21305
26 21740
...

result:

ok 500000 lines

Test #10:

score: 0
Accepted
time: 779ms
memory: 17220kb

input:

2
250000
1 166085
2 52706
2 51784
3 23379
2 209734
1 191492
5 119361
4 137
1 131744
9 161929
7 62827
9 238737
10 84433
7 67633
6 69366
1 105069
4 194861
9 74477
11 214963
8 9757
5 149316
15 182750
22 42579
11 150931
15 88679
3 36229
13 6440
11 236704
7 164790
1 139475
24 172162
9 219844
13 171219
21...

output:

1 1
1 3
1 9
1 11
1 108
1 154
1 1417
1 1755
1 43281
1 94395
1 124308
3 187673
5 49048
5 144033
6 192250
7 231652
9 137838
9 168540
9 182410
13 7599
13 20846
13 40830
13 51999
13 54448
13 59654
13 150698
14 186587
14 189535
15 207779
15 227140
18 243882
20 160546
20 220045
22 219925
25 144884
25 14766...

result:

ok 500000 lines

Test #11:

score: 0
Accepted
time: 794ms
memory: 17044kb

input:

2
250000
1 214930
1 182183
1 247857
2 207367
5 46621
5 27044
5 221603
7 198054
6 162006
3 208874
9 236413
7 80416
1 203154
8 249390
8 86532
11 141147
4 138294
14 201781
6 162334
6 17164
7 234726
22 249908
9 136367
22 192471
8 84441
11 37985
18 31069
3 96642
29 211411
12 147280
2 112780
32 207122
26 ...

output:

1 2
1 2
1 3
1 14
1 29
1 104
1 156
1 350
1 528
1 1731
1 2668
1 2800
1 4171
1 4911
1 38745
1 242980
3 48572
3 109710
3 207351
5 149228
7 241168
9 14444
9 17910
9 36975
10 57039
10 153287
11 226151
13 60664
14 147269
15 190920
15 199053
17 228512
19 22136
19 45575
21 41291
21 57488
21 79146
21 190463
2...

result:

ok 500000 lines

Test #12:

score: 0
Accepted
time: 895ms
memory: 21516kb

input:

1
500000
1 207180
1 175707
2 279069
1 127565
5 67964
3 297823
3 124394
6 232606
7 116895
2 283689
10 382596
7 147638
7 45977
4 469965
8 363376
13 342028
5 111568
13 43009
9 7539
1 95667
21 92360
19 176090
23 485457
4 496578
8 264166
7 231981
12 282865
19 331438
21 394480
25 484366
19 315735
12 15911...

output:

1 1
1 5
1 12
1 16
1 24
1 4615
1 28525
1 29150
1 67183
1 75996
1 148796
1 182304
1 207289
4 319022
4 364779
7 80582
7 160784
7 188563
7 247649
7 430229
9 495594
11 209108
14 369117
14 381247
15 391264
18 385336
18 474910
21 33839
21 47253
21 182385
21 310370
21 319375
21 369215
21 494773
26 252038
26...

result:

ok 500000 lines

Test #13:

score: 0
Accepted
time: 619ms
memory: 21576kb

input:

1
500000
1 31832
1 272481
2 225142
1 35745
5 404850
5 324863
6 450827
1 404715
1 397157
10 356442
10 306182
4 22021
2 131993
13 119018
10 163246
7 385002
4 55000
14 413418
11 237613
15 385778
6 486282
22 243249
7 46541
16 320822
9 484121
19 451032
13 281685
11 158672
3 441101
20 274874
23 197840
3 1...

output:

1 1
1 1
1 2
1 4
1 8
1 10
1 12
1 22
1 179
1 404
1 637
1 739
1 2610
1 3041
1 4500
1 7126
1 11403
1 13870
1 16451
1 25869
1 104239
1 208177
1 258871
1 383046
1 422183
2 477827
4 408096
4 438852
6 411746
9 379857
11 171714
11 343501
12 452078
15 136244
16 164671
16 474770
18 230775
18 253762
18 425709
1...

result:

ok 500000 lines

Test #14:

score: 0
Accepted
time: 590ms
memory: 21588kb

input:

1
500000
1 80676
1 158855
1 428111
4 187029
5 209032
6 160415
5 20365
4 352632
6 401611
8 153387
1 421255
10 87892
1 474905
14 76583
5 463116
1 138376
4 31136
11 283826
14 467688
16 418993
12 71693
7 277703
13 140328
3 79658
23 45292
26 202788
23 280506
24 485906
26 487722
7 308486
4 421161
26 40947...

output:

1 1
1 1
1 2
1 2
1 17
1 21
1 25
1 37
1 61
1 136
1 245
1 323
1 760
1 15175
1 59530
2 124818
3 206024
3 253557
4 377967
6 434530
8 41957
8 146577
9 155640
11 229124
11 253489
12 312549
15 8914
15 14302
15 16452
15 23202
15 62540
15 152971
15 195718
17 196744
18 232303
18 419408
20 341957
21 481935
23 1...

result:

ok 500000 lines

Test #15:

score: 0
Accepted
time: 781ms
memory: 21480kb

input:

1
500000
1 96817
2 288332
3 406888
3 403722
5 480511
4 187454
5 346798
7 300549
1 149169
5 450331
2 69033
7 462276
13 285114
10 192932
9 262987
11 148647
13 474569
12 378426
10 389251
14 176399
4 189807
6 312158
23 168708
23 403902
16 265246
12 113328
22 55134
16 345845
7 67047
2 66290
9 303266
17 4...

output:

1 1
1 1
1 1
1 16
1 1050
1 1112
1 17025
1 50618
1 64414
1 332289
3 195588
3 414993
5 221923
5 321738
5 335653
7 339182
8 458027
10 421433
12 388669
14 37271
14 98117
14 124638
14 189164
14 272493
14 464041
16 289964
18 368025
19 385070
19 387648
21 429897
23 133615
23 359415
23 397119
25 397081
27 39...

result:

ok 500000 lines

Test #16:

score: 0
Accepted
time: 162ms
memory: 21428kb

input:

1
500000
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 ...

output:

1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52
53 53
...

result:

ok 500000 lines

Test #17:

score: 0
Accepted
time: 176ms
memory: 52680kb

input:

1
500000
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
...

output:

1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 61
1 62...

result:

ok 500000 lines

Extra Test:

score: 0
Extra Test Passed