QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#108715#1226. 弹跳asdf1234coding100 ✓1992ms42416kbC++203.5kb2023-05-26 14:04:142023-05-26 14:04:18

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 4
Accepted
time: 4ms
memory: 16344kb

input:

5 5 5 5
4 5
1 5
1 4
3 5
2 3
1 7122 2 4 4 5
2 9152 1 4 3 5
1 6403 1 5 1 5
3 5455 3 5 2 3
2 7402 1 3 1 4

output:

6403
6403
6403
6403

result:

ok 4 lines

Test #2:

score: 4
Accepted
time: 3ms
memory: 16224kb

input:

10 10 10 10
1 6
6 2
8 5
8 3
2 4
2 9
5 4
7 2
6 7
5 8
4 6852 6 8 1 8
1 6901 1 7 2 10
9 6605 5 6 5 6
5 5888 1 2 2 6
5 9363 4 10 5 9
6 7276 4 10 3 4
1 8402 9 10 7 10
7 6296 6 10 7 9
9 6425 5 5 1 6
6 4709 2 6 4 8

output:

6901
16264
14177
6901
6901
6901
6901
6901
6901

result:

ok 9 lines

Test #3:

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

input:

20 20 20 20
6 9
18 5
3 16
10 6
17 8
19 14
6 7
3 13
13 9
11 14
18 8
2 6
7 7
15 18
9 19
14 6
10 1
15 11
5 1
19 7
18 8070 2 16 4 5
19 7928 15 19 9 17
13 7145 5 18 7 17
12 8771 8 10 16 18
16 6658 11 18 16 19
5 8322 10 16 6 10
5 8155 12 13 3 20
17 9143 6 20 13 20
20 7628 7 13 4 11
1 7636 5 18 1 13
1 9983...

output:

7636
9983
7636
7636
9983
7636
9983
7636
9983
7636
9983
7636
9983
9910
7636
7636
7636
7636
9983

result:

ok 19 lines

Test #4:

score: 4
Accepted
time: 4ms
memory: 16352kb

input:

30 30 30 30
9 1
25 10
26 29
19 3
3 28
17 25
4 29
16 27
9 9
23 2
21 20
3 17
16 17
24 11
24 15
21 4
5 8
28 29
8 12
12 19
6 2
8 19
18 28
10 13
10 24
23 9
19 26
5 13
20 21
27 4
24 5600 8 19 6 11
23 9190 15 25 8 13
1 7775 1 17 10 22
14 8194 12 30 8 11
28 9155 9 16 16 20
22 8175 23 27 11 26
22 6947 15 28 ...

output:

14722
29051
9327
14994
17576
14994
14994
13375
9327
17576
7775
7775
15950
15950
9327
17759
29051
7775
7775
19133
7775
14994
7775
17576
14722
14994
7775
17576
22171

result:

ok 29 lines

Test #5:

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

input:

50 50 50 50
40 37
47 44
35 38
43 39
30 21
29 30
6 27
45 30
1 19
24 2
14 16
7 32
7 44
3 25
35 27
7 22
43 46
11 47
29 24
26 46
7 28
13 11
30 38
11 36
28 31
34 1
21 30
31 40
28 2
6 18
34 23
13 49
11 18
29 23
35 43
5 11
27 26
16 17
46 13
38 28
32 16
45 5
25 20
29 31
36 20
46 28
16 9
36 46
49 4
25 17
36 ...

output:

21670
24201
21670
15766
15766
12223
23094
12599
22292
12223
12599
12599
12223
22292
12223
21670
23758
15766
27293
12599
26868
15766
12599
6806
23094
15766
15766
22292
12223
22292
29001
12223
15766
21670
29556
15766
12223
22103
22292
15766
23094
15766
15766
22103
27293
26868
21670
31592
15766

result:

ok 49 lines

Test #6:

score: 4
Accepted
time: 1ms
memory: 16352kb

input:

70 70 70 70
2 37
23 64
46 20
13 40
33 46
16 52
42 32
69 65
48 12
36 8
18 7
54 14
19 54
47 64
70 29
5 17
55 36
48 53
1 64
11 50
52 4
22 69
11 37
66 69
5 20
69 60
26 57
15 3
1 28
52 68
38 66
59 50
32 3
37 45
45 36
51 50
1 56
63 45
26 29
5 54
11 17
60 13
25 58
68 4
43 8
32 36
55 21
39 30
34 43
44 28
26...

output:

11848
11500
11109
5122
5122
10325
19225
11500
11500
11109
11313
5122
11848
20091
10615
10325
11987
10783
18442
16447
16672
11109
24625
10615
19225
15084
11109
10783
16672
15084
11662
11109
5122
5122
11662
10783
10325
10325
10783
10615
11313
15084
24625
11500
5122
11313
10325
5122
10325
5122
10615
11...

result:

ok 69 lines

Test #7:

score: 4
Accepted
time: 1ms
memory: 16248kb

input:

90 90 90 90
76 90
85 69
40 65
5 49
25 35
79 76
29 69
2 31
44 85
22 55
42 57
47 45
49 43
27 37
19 45
77 38
21 73
25 70
25 60
69 24
7 64
11 85
32 61
84 16
41 71
41 54
8 54
76 59
53 47
10 65
74 21
70 11
55 27
15 78
27 26
34 23
35 47
21 24
11 26
43 86
48 47
68 68
28 67
38 41
84 40
67 30
66 70
15 24
73 3...

output:

21404
13840
14944
13840
19599
13840
14944
20699
13840
13840
13840
13840
13840
13840
14944
18076
18076
13840
14305
5509
21404
13840
14944
20501
13840
5509
14944
13840
5509
14944
14305
13840
20699
13840
13840
13840
13840
13840
20699
13840
20226
13840
13840
14944
14305
17366
13840
14305
13840
13840
550...

result:

ok 89 lines

Test #8:

score: 4
Accepted
time: 3ms
memory: 16156kb

input:

100 100 100 100
1 25
98 50
79 57
86 45
100 26
41 66
34 67
14 27
73 24
23 30
62 18
83 79
31 45
36 18
24 36
83 33
59 81
6 64
21 56
32 51
21 44
18 34
49 30
44 75
64 17
76 76
31 88
10 98
22 17
98 53
8 84
50 49
8 62
6 48
10 46
4 8
28 57
77 55
40 37
21 60
86 69
23 77
51 43
20 79
5 79
27 39
86 30
42 44
43 ...

output:

19541
9463
9463
24647
14648
14648
15218
17066
15218
17261
18167
14648
17261
16614
17687
14648
17687
15218
14648
15218
15218
17261
14648
17261
19541
14648
22279
17261
19541
20400
14648
17261
17261
15218
22319
16614
9463
16614
15218
9463
15218
17261
15218
20400
16614
17687
16614
14648
9463
14648
9463
...

result:

ok 99 lines

Test #9:

score: 4
Accepted
time: 8ms
memory: 16756kb

input:

5000 5000 5000 5000
3825 2447
1008 4770
2985 2073
4409 1209
3894 2540
2247 123
2558 2296
3831 4603
1889 3960
2687 1236
901 3082
2917 1545
2628 1413
848 4598
4856 1528
4136 4536
713 52
605 449
719 2200
1447 1363
208 3176
3706 208
1985 711
1811 1750
1291 4987
4499 1635
2292 112
2770 1208
4805 2013
120...

output:

12408133
21755437
13804855
11108200
2889480
3530808
2800916
16640969
2420442
132002
19015585
4562237
4228623
7445492
16018761
11415957
5833243
6666812
9632625
11212491
14187046
13176749
8882279
3664472
11707377
12685368
7302157
2320525
4741296
18596768
2544367
1376586
18983359
12012050
6847052
11421...

result:

ok 4999 lines

Test #10:

score: 4
Accepted
time: 52ms
memory: 19116kb

input:

30000 40000 30000 30000
28836 27730
17280 2314
25216 21349
28471 649
23412 13385
25289 13110
21414 14623
5560 23443
24501 29616
2209 15298
24411 28995
23850 29644
12906 29582
27536 15048
14035 25040
23403 14699
24699 22384
29754 23381
893 9167
23472 14109
25897 13661
451 6789
22429 2258
8168 3104
23...

output:

243324
230217
208926
194902
222873
168830
199226
224170
245972
198962
195544
190429
211588
110866
258030
200907
158237
155818
211793
233653
181546
222519
188869
231588
242549
182960
187871
159482
191625
107789
137377
215080
275104
203718
264478
222687
230589
203289
172752
207411
156052
196093
186881...

result:

ok 29999 lines

Test #11:

score: 4
Accepted
time: 68ms
memory: 21256kb

input:

40000 60000 40000 40000
2494 16660
28552 29858
32447 15625
32533 1442
17930 34230
18331 31097
13917 13303
17289 8636
27113 13919
11731 23007
17921 4908
11136 12743
29537 1398
9224 10498
8214 4905
2670 38509
2332 23363
15256 26313
19714 27487
497 1855
11586 15499
12196 8370
22873 2452
20878 4458
4950...

output:

211351
144421
174325
149473
152191
176757
183242
72786
155368
187311
230790
197428
176773
161903
139140
153872
224126
178509
204091
160532
193558
126119
164417
231998
140373
181366
177896
142109
183925
122883
181530
147001
165610
176016
131232
189486
162137
160681
177542
147245
193990
170984
158411
...

result:

ok 39999 lines

Test #12:

score: 4
Accepted
time: 91ms
memory: 21744kb

input:

45000 80000 45000 45000
41152 16943
6177 37402
18325 29901
21595 15882
31095 75
41373 39084
22773 11983
9018 27476
24725 33222
44900 12069
6431 19468
32069 35842
1168 44567
5912 948
42393 8417
1937 8672
34965 15695
10758 19245
28535 29454
2522 38248
35922 12337
18941 8598
38317 37646
2235 35812
3745...

output:

133118
150154
132750
128454
109329
112959
118897
120652
120794
109286
142494
108254
117489
139187
86820
118125
130085
80843
86242
110185
85787
130082
128930
112360
132594
112385
90757
125654
145770
114162
114342
117064
84944
128639
135117
80126
116046
114211
126317
71786
122356
138987
93527
125833
1...

result:

ok 44999 lines

Test #13:

score: 4
Accepted
time: 110ms
memory: 22400kb

input:

50000 100000 50000 50000
46163 10873
7449 14946
20556 7824
40657 10322
40613 19567
4415 37071
35276 24310
40747 2669
2337 48878
44422 1131
24941 30381
19355 8941
6446 11383
36247 21398
40219 31929
21204 48835
43951 18027
6260 2177
43709 41421
4547 994
46611 42822
35686 25179
13761 29193
19945 813
33...

output:

119042
95448
84361
65033
97479
84972
125684
102528
97100
100842
91847
87906
136659
95238
103365
106366
95906
99132
77257
101801
105192
88101
84449
94112
94840
105372
106740
85782
106319
106937
74884
88078
93177
97646
106415
105608
110475
102246
79768
89164
86255
116941
109317
115156
105943
83452
105...

result:

ok 49999 lines

Test #14:

score: 4
Accepted
time: 145ms
memory: 19676kb

input:

30000 40000 30000 1
16545 1
3257 1
25446 1
15225 1
15576 1
1641 1
22051 1
12785 1
18458 1
26728 1
25295 1
454 1
28889 1
18441 1
9996 1
22571 1
11463 1
6292 1
13512 1
22012 1
10052 1
11580 1
2691 1
5872 1
12869 1
17716 1
15544 1
19524 1
19435 1
6950 1
27563 1
20430 1
27208 1
11956 1
9956 1
9150 1
240...

output:

6064
6180
6064
6064
6064
6064
6064
6064
6180
6180
6214
6317
6064
6064
6180
6064
6064
6064
6064
6064
6064
6064
6064
6064
6064
6064
6064
6064
6064
6180
6064
6180
6064
6064
6064
6180
6064
6180
6180
6064
6180
6633
6180
6180
6064
6064
6064
6064
6180
6064
6180
6064
6064
6064
6064
6180
6064
6064
6064
6064
...

result:

ok 29999 lines

Test #15:

score: 4
Accepted
time: 237ms
memory: 24576kb

input:

40000 60000 40000 1
9832 1
29993 1
25018 1
12428 1
3296 1
30499 1
16635 1
24205 1
37561 1
17113 1
31961 1
7574 1
19708 1
19623 1
28577 1
39738 1
29217 1
911 1
11351 1
28597 1
37989 1
19176 1
28296 1
2659 1
2268 1
14869 1
2585 1
12711 1
223 1
3258 1
35467 1
27748 1
34710 1
9082 1
667 1
23068 1
732 1
...

output:

8731
8744
8733
8733
8731
8577
8733
8746
8577
8731
8733
8733
8733
8731
9674
8731
9111
8733
8731
8746
8733
8731
8733
9111
8577
8733
8733
9111
8733
8746
8731
8746
8733
9111
8733
9111
9111
8731
8744
8577
8733
9111
8744
8733
8733
8733
8731
8746
8733
8731
8733
8731
8731
8746
8746
8731
8731
8746
8746
8733
...

result:

ok 39999 lines

Test #16:

score: 4
Accepted
time: 399ms
memory: 25280kb

input:

45000 80000 45000 1
33490 1
31265 1
25896 1
1490 1
1461 1
13541 1
40491 1
30934 1
40173 1
31635 1
15471 1
3507 1
9986 1
39958 1
17756 1
19005 1
38203 1
41413 1
21525 1
5622 1
17325 1
10921 1
33740 1
35369 1
4774 1
37813 1
29075 1
31260 1
26126 1
44277 1
43491 1
35954 1
2118 1
29015 1
4648 1
12434 1
...

output:

9799
9824
9940
9940
9698
9799
9799
9799
9799
9698
9823
9838
9799
9698
9698
9799
9799
9698
9823
9698
9865
9799
9799
9823
9799
9799
9799
9824
9881
9881
9799
9915
9799
9823
9698
9799
9799
9799
9824
9823
9865
9799
9799
9799
9823
9823
9698
9698
9799
9824
9799
9799
9823
9799
9824
9698
9881
9698
9698
11142...

result:

ok 44999 lines

Test #17:

score: 4
Accepted
time: 433ms
memory: 25556kb

input:

48000 90000 48000 1
29501 1
16890 1
27127 1
32552 1
27979 1
936 1
1994 1
23663 1
26785 1
20157 1
10981 1
25793 1
32617 1
30646 1
40582 1
26272 1
44836 1
31915 1
29346 1
26647 1
33014 1
42666 1
25184 1
3726 1
24927 1
10757 1
9565 1
41809 1
10029 1
36943 1
3868 1
45807 1
17526 1
30948 1
30629 1
3447 1...

output:

6041
6041
5919
6041
6112
6041
6041
6041
6041
6041
6041
5919
6041
6041
6041
6156
5919
6041
6041
5919
6041
6041
6041
6041
6041
6041
6041
6041
6041
6041
6156
6041
6041
6041
6041
6041
6041
6041
6041
6041
6041
6041
6041
6041
6041
6041
6041
5919
6041
5919
6041
6041
6041
6041
6041
5919
6041
6041
6041
6041
...

result:

ok 47999 lines

Test #18:

score: 4
Accepted
time: 525ms
memory: 25872kb

input:

50000 100000 50000 1
47159 1
30162 1
40358 1
44614 1
14144 1
35978 1
46850 1
49392 1
31750 1
9326 1
26138 1
6726 1
23248 1
28334 1
44761 1
17539 1
48469 1
17417 1
20520 1
39672 1
8703 1
44411 1
49628 1
34436 1
38433 1
18701 1
7055 1
48358 1
2932 1
19962 1
15892 1
31013 1
13287 1
3881 1
33963 1
19813...

output:

5632
5632
5549
5606
5632
5549
5805
5632
5620
5606
5691
5606
5606
5549
5606
5549
5606
5606
5632
5620
5549
5845
5632
5632
5606
5691
5549
5691
5606
5606
5632
5606
5691
5632
5606
5632
5691
5606
5691
5606
5549
5549
5632
5691
5606
5845
5691
5691
5549
5632
5606
5606
5606
5549
5845
5625
5606
5606
5606
5691
...

result:

ok 49999 lines

Test #19:

score: 4
Accepted
time: 243ms
memory: 20428kb

input:

20000 35000 20000 20000
5471 18747
2751 19503
12466 12617
4116 6941
15860 10134
9054 345
3644 1130
4013 9668
6943 5371
4267 14099
12359 13382
2795 1463
10253 11728
18835 16303
1173 10946
5591 15932
16394 16774
3780 8598
7433 303
7942 18906
5967 1982
11209 12434
9104 17823
5824 1225
35 1716
6500 2322...

output:

9321
8172
8326
8224
9120
9079
8326
7806
7806
8172
8613
8172
8284
8483
8284
8224
8326
9120
8593
8613
8172
8284
8650
12967
7806
8224
8613
8353
7644
7806
8322
8224
8811
8468
8483
8172
7806
8172
8172
8172
8742
8172
7806
8172
7806
8172
8483
7806
8483
9079
7644
8284
8650
8326
8172
7806
8468
8172
8284
8483...

result:

ok 19999 lines

Test #20:

score: 4
Accepted
time: 273ms
memory: 20652kb

input:

20000 40000 20000 20000
828 18795
2706 17754
8467 15050
2738 10461
6827 9129
2062 2980
18209 12364
2850 7255
6974 18058
8370 506
3158 5419
14945 6987
10157 13154
5357 9548
13119 19219
2426 7270
10088 10292
2068 2701
18162 7896
3722 12510
3728 2982
17901 17187
516 16904
3503 13938
17092 7834
942 9395...

output:

6403
6403
6403
6403
6293
6610
6293
6403
7264
6293
6293
6403
6403
6403
6293
6403
6293
6610
6403
6293
6735
7648
6403
6610
6610
6403
6403
7893
6403
6525
6403
6293
6403
6403
6403
6735
6293
6403
6293
7013
6403
6293
6403
6403
6403
6403
6403
6403
6293
6403
6403
6403
6403
7346
6610
6403
6403
6403
6403
6293
...

result:

ok 19999 lines

Test #21:

score: 4
Accepted
time: 299ms
memory: 22692kb

input:

25000 37000 25000 25000
15279 1138
9718 2873
16821 3894
12874 16829
2475 7407
15236 16339
23373 19956
16659 23894
19385 19169
15135 19846
22898 9391
3788 15027
14317 1962
24765 10084
18861 22325
23034 12397
10154 4005
2089 8540
15875 21638
13063 18873
15848 1002
4217 23763
2910 10884
14606 12533
148...

output:

7866
8050
7938
8576
7938
8673
8502
7938
8174
8534
8174
8050
8763
8411
8534
7866
8500
8174
7938
8050
8174
8296
7946
8296
8795
7938
7646
9946
7938
8050
7938
8050
8622
8050
7646
7946
8050
9777
7938
7646
8174
8254
8492
7866
8622
8050
8576
7938
7938
8502
8717
8682
8254
8500
8050
8050
7646
7866
7866
7866
...

result:

ok 24999 lines

Test #22:

score: 4
Accepted
time: 315ms
memory: 22760kb

input:

25000 40000 25000 25000
17413 9854
13909 3404
12640 343
5183 22931
8304 11427
17054 22229
2331 23758
14717 4486
2731 24890
1633 3636
6935 809
23487 981
18482 13260
7982 7769
3526 5012
6773 22031
10614 12562
20957 22462
9142 22938
6162 15328
10458 8285
12487 4630
17499 2073
18701 21402
22096 1288
197...

output:

6640
7205
6276
6923
7088
7870
6640
9662
7271
7205
8181
6923
6771
6771
6276
6778
7088
7035
6276
6771
6640
6923
7088
7247
6923
6778
7144
7876
7144
6778
7543
7205
6923
7247
6923
6771
6771
6276
6906
7205
6923
7543
6405
6906
6891
6405
7553
6276
7221
6640
7144
7156
6937
6276
6923
6923
6906
7553
7162
8428
...

result:

ok 24999 lines

Test #23:

score: 4
Accepted
time: 1512ms
memory: 31176kb

input:

60000 130000 60000 60000
12335 27642
37270 35969
59523 10353
4646 52378
18726 55588
50928 15285
53817 46994
51977 29636
24658 2240
16947 40419
2883 38981
34094 55182
44803 25249
40233 36956
55359 21174
3855 22062
21425 15162
36364 13367
3853 27277
24231 42942
12879 50289
20587 14438
34015 11346
3066...

output:

6336
6470
6438
6360
6295
6295
6295
6386
6203
6482
6360
6313
6336
6295
6237
6058
6058
6237
6336
6386
6058
6237
6360
6295
6295
6331
6058
6336
6058
6478
6336
6203
6058
6058
6295
6237
6386
6484
6214
6408
6228
6295
6295
6295
6418
7886
6339
6058
6295
7061
6336
6237
6258
8097
6386
6336
6295
6058
6408
6386
...

result:

ok 59999 lines

Test #24:

score: 4
Accepted
time: 1667ms
memory: 39492kb

input:

65000 140000 65000 65000
64857 62172
20953 7391
46828 33949
30620 17760
34027 54336
22372 24297
57942 25062
36660 48895
57223 8641
30007 61058
14311 10526
37478 23787
59971 1064
26212 37472
46460 58207
35013 53679
47231 43843
38192 45569
38203 34733
33050 7236
29701 13293
52296 44507
28204 40258
259...

output:

8899
8945
8899
9095
8899
8986
8945
9092
9402
8899
8945
9332
8986
9140
9011
8945
8945
8945
8899
8899
8945
8986
8899
9199
8899
9806
9092
9092
8945
9268
9271
9026
8945
9409
9095
9092
8899
8945
9140
9140
8899
8986
8945
9092
8899
9114
9024
9393
8945
8899
8945
9409
8945
9168
9309
8986
8945
8899
8899
8899
...

result:

ok 64999 lines

Test #25:

score: 4
Accepted
time: 1992ms
memory: 42416kb

input:

70000 150000 70000 70000
25545 33267
14462 48276
49031 29071
6214 38395
63273 24794
671 69954
14551 30641
44627 10561
19576 30512
65848 20389
687 65695
51362 38656
22284 8614
29772 60178
25790 41984
47586 48501
264 18023
45512 35534
43738 49591
62892 46444
22238 31805
8184 42368
47831 43973
59054 41...

output:

13455
13524
13545
13612
19411
13524
13612
13524
13866
15080
13478
13656
13455
13478
13455
15080
13524
13455
13612
13524
13545
13478
13612
13478
13545
13612
13612
13846
13612
13455
13545
14255
13524
13671
13612
13545
13624
13667
13579
13524
13612
13455
13455
13478
13660
13612
13524
13667
13524
13524
...

result:

ok 69999 lines

Extra Test:

score: 0
Extra Test Passed