QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#481942#3159. Sugar Gliderstoccf100 ✓70ms16776kbC++142.8kb2024-07-17 16:22:272024-07-17 16:22:31

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 25
Accepted

Test #1:

score: 25
Accepted
time: 0ms
memory: 7120kb

input:

1000 1002 55
100
11
3
46
40
11
11
35
21
40
5
19
24
16
30
35
12
44
22
5
14
3
21
48
47
12
27
16
48
18
22
10
17
1
37
48
8
36
38
19
27
21
6
6
23
24
20
10
25
4
16
33
3
19
3
25
41
34
18
17
17
1
11
13
42
41
10
33
43
13
23
24
21
19
31
19
48
8
32
15
15
22
29
2
7
6
43
29
21
11
13
6
43
40
37
11
17
29
49
44
40
...

output:

-1

result:

ok single line: '-1'

Test #2:

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

input:

1000 2699 22
22
11
52
60
49
45
31
20
9
57
5
58
39
52
29
19
48
53
3
30
62
42
60
2
68
54
55
13
64
67
29
23
66
56
17
3
26
9
36
50
36
35
55
10
2
29
54
15
36
53
30
16
38
30
62
12
40
35
40
55
14
60
5
39
56
41
32
6
15
42
48
61
3
24
31
51
20
51
20
37
10
20
7
15
17
68
47
20
37
57
47
16
2
16
58
31
18
20
25
19...

output:

168

result:

ok single line: '168'

Test #3:

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

input:

1000 3000 100
100
24
35
18
3
17
12
8
20
37
12
4
4
11
37
27
23
4
14
22
12
42
4
22
4
12
27
44
30
24
44
30
5
17
42
19
3
21
37
41
49
18
10
23
48
34
47
10
6
33
17
4
35
22
21
27
47
47
37
36
11
34
7
40
34
20
10
4
3
4
12
39
19
50
32
4
50
28
18
42
38
43
27
4
46
13
21
2
40
5
21
24
31
12
8
16
45
2
49
5
7
14
22...

output:

149

result:

ok single line: '149'

Test #4:

score: 0
Accepted
time: 1ms
memory: 7372kb

input:

876 1139 3
6
40
4
43
14
1
1
4
36
45
38
20
50
39
7
12
43
27
40
6
44
13
48
44
44
47
19
33
29
44
47
32
18
6
12
26
3
49
50
4
18
16
50
3
13
4
18
4
19
16
42
32
1
32
45
8
21
7
37
39
11
43
30
13
50
41
7
3
24
16
23
15
40
7
41
14
46
32
35
50
38
45
15
18
42
50
27
41
42
25
43
48
36
21
29
3
21
39
18
47
1
10
48
4...

output:

461

result:

ok single line: '461'

Test #5:

score: 0
Accepted
time: 1ms
memory: 7060kb

input:

609 1507 66
85
15
19
37
27
16
51
34
46
13
2
36
2
37
35
23
58
51
34
21
56
18
19
43
26
17
61
48
1
18
14
22
48
53
27
22
50
48
10
44
53
8
51
13
6
38
52
22
4
42
23
32
42
42
50
44
54
19
58
16
55
41
40
29
40
5
29
29
16
40
26
18
8
37
48
43
42
51
19
2
15
59
17
47
4
8
39
31
61
6
21
42
59
16
59
16
15
60
60
58
...

output:

228

result:

ok single line: '228'

Test #6:

score: 0
Accepted
time: 1ms
memory: 7136kb

input:

547 39 50
50
38
28
36
43
42
2
7
40
22
5
27
1
12
26
16
2
38
3
9
33
4
9
14
3
16
35
49
40
38
28
47
21
1
13
25
45
13
35
4
26
22
25
47
4
23
21
49
26
39
38
41
26
8
28
16
47
25
1
2
33
17
3
29
48
9
47
42
32
35
10
2
34
45
9
48
6
32
26
27
31
34
45
22
25
50
38
2
42
26
30
12
38
29
44
8
42
16
48
26
27
49
36
22
1...

output:

130

result:

ok single line: '130'

Test #7:

score: 0
Accepted
time: 1ms
memory: 6900kb

input:

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

output:

1299

result:

ok single line: '1299'

Test #8:

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

input:

1000 3000 57
65
27
19
30
47
32
9
27
23
10
10
21
44
43
19
19
22
11
30
21
35
10
18
24
50
4
43
10
25
28
28
13
48
17
2
35
34
31
12
18
23
29
23
44
44
3
21
36
12
10
13
34
40
23
27
48
36
28
19
4
10
19
11
10
43
24
23
41
12
24
38
49
28
40
46
25
42
3
50
43
34
31
25
32
46
46
48
3
22
38
24
49
21
50
15
15
36
9
1...

output:

125

result:

ok single line: '125'

Test #9:

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

input:

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

output:

76

result:

ok single line: '76'

Test #10:

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

input:

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

output:

77

result:

ok single line: '77'

Test #11:

score: 0
Accepted
time: 0ms
memory: 6832kb

input:

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

output:

-1

result:

ok single line: '-1'

Test #12:

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

input:

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

output:

149

result:

ok single line: '149'

Test #13:

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

input:

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

output:

138

result:

ok single line: '138'

Test #14:

score: 0
Accepted
time: 0ms
memory: 6888kb

input:

170 920 27
79
45
15
14
32
42
41
6
34
38
36
43
38
6
14
27
34
28
31
7
38
14
38
22
17
24
14
19
11
37
3
49
44
45
7
2
14
45
21
13
7
35
44
35
37
15
27
50
50
25
4
35
28
33
30
38
34
25
10
50
42
43
21
46
30
17
36
31
50
21
7
1
6
35
18
37
24
24
5
6
31
32
32
22
6
15
8
20
7
11
4
4
27
43
26
2
29
50
37
22
47
37
39...

output:

86

result:

ok single line: '86'

Test #15:

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

input:

437 2650 88
100
23
10
15
34
44
47
1
30
19
47
20
22
12
32
4
30
18
43
23
18
46
48
28
3
50
40
23
7
1
6
41
8
25
47
19
45
23
19
37
40
46
45
49
9
45
43
36
35
48
40
35
15
17
45
35
13
13
43
17
38
4
8
32
35
9
16
31
49
38
29
10
14
23
49
19
4
41
48
20
15
34
1
46
33
32
21
10
38
3
42
23
5
39
18
41
16
33
40
17
1
...

output:

130

result:

ok single line: '130'

Test #16:

score: 0
Accepted
time: 0ms
memory: 6904kb

input:

1000 961 65
100
43
25
29
1
26
45
40
43
5
13
4
14
13
10
5
30
5
32
6
22
6
12
9
23
18
18
33
11
41
37
34
47
7
1
2
3
48
20
21
17
37
3
45
42
23
34
17
5
48
32
40
47
47
14
33
28
44
31
19
7
45
24
40
10
15
9
40
41
48
19
5
11
23
3
32
50
25
7
23
20
45
19
21
26
40
21
25
19
29
42
40
10
11
15
38
19
44
29
9
32
25
3...

output:

-1

result:

ok single line: '-1'

Test #17:

score: 0
Accepted
time: 0ms
memory: 6836kb

input:

1000 289 71
100
49
26
42
32
3
48
20
34
6
19
2
42
15
47
16
27
44
11
10
46
28
28
41
51
7
39
38
50
6
19
33
28
39
30
50
34
28
34
49
48
14
14
35
34
2
12
38
35
30
43
16
30
22
30
24
3
12
3
49
1
39
49
28
46
22
11
12
30
15
5
15
8
5
10
21
16
22
38
2
31
37
41
49
51
24
50
31
29
23
19
7
41
12
22
26
1
40
52
17
11...

output:

8659

result:

ok single line: '8659'

Test #18:

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

input:

1000 705 5
5
39
43
36
45
37
29
31
21
37
17
1
45
45
41
11
22
38
36
30
31
49
29
30
3
3
2
4
11
8
11
27
27
15
42
44
40
31
27
38
43
48
30
20
21
14
20
18
15
24
4
15
9
45
45
45
20
3
17
15
27
34
29
37
1
12
9
24
8
16
30
18
24
1
37
49
23
48
32
20
14
23
28
26
29
23
1
35
32
5
42
44
31
32
39
15
16
49
31
36
8
27
...

output:

7672

result:

ok single line: '7672'

Test #19:

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

input:

1000 392 24
100
46
33
47
40
39
25
45
30
23
13
34
42
44
49
25
35
5
13
38
8
2
19
23
44
44
40
38
8
42
45
47
45
42
27
20
19
32
46
7
35
9
30
4
41
28
24
42
4
29
29
38
39
22
23
20
37
23
20
47
28
46
42
29
39
37
18
39
9
23
48
16
48
7
48
3
20
27
27
30
17
7
10
9
11
28
38
40
12
16
34
10
40
12
11
7
50
8
39
38
7
...

output:

8259

result:

ok single line: '8259'

Test #20:

score: 0
Accepted
time: 0ms
memory: 6912kb

input:

1000 993 57
88
6
27
4
35
49
21
14
2
48
27
47
2
7
9
23
33
30
18
1
32
50
12
40
28
15
40
8
21
16
8
34
4
32
26
17
27
12
36
27
6
18
30
32
25
30
8
19
24
41
45
36
36
45
24
32
3
11
39
2
33
13
2
19
50
28
6
26
42
14
14
14
44
41
35
17
20
31
1
14
36
41
21
42
21
23
44
50
19
32
8
19
37
46
20
43
3
7
19
3
26
45
18
...

output:

6046

result:

ok single line: '6046'

Subtask #2:

score: 25
Accepted

Test #21:

score: 25
Accepted
time: 65ms
memory: 16176kb

input:

100000 300000 0
1000000000
6252036
2478953
10427170
9627366
7209791
2693718
9708485
7249936
10617908
6324658
7316124
2936320
6127220
10315955
1335528
8828453
5276518
5323734
908445
4214021
9084361
7603977
2594805
4889830
10745625
10186019
7628251
3182274
7028365
1117322
4415746
7061952
7575909
61522...

output:

91684617

result:

ok single line: '91684617'

Test #22:

score: 0
Accepted
time: 37ms
memory: 15888kb

input:

18628 300000 0
1000000000
451191979
504164906
81274270
360402988
150343635
124699825
158575812
129200008
106549527
60508419
98119895
342585670
287291320
200857843
544297702
92724275
6576299
88098732
258551216
216318047
189873309
262538576
503909318
101348740
422816599
112157613
425144018
419443172
5...

output:

358898213

result:

ok single line: '358898213'

Test #23:

score: 0
Accepted
time: 33ms
memory: 11504kb

input:

95707 122429 0
325381813
7728322
7640388
7314166
6483446
3526898
9290172
4844753
805136
6571737
8860798
6094569
6157170
1509383
8787144
5086011
5730745
1936819
8189050
3111015
1556244
3309258
5912520
8644284
7465066
3486401
2704687
5197828
2440225
1505647
6240983
8930144
5885634
7450651
9414293
3416...

output:

202573214

result:

ok single line: '202573214'

Test #24:

score: 0
Accepted
time: 56ms
memory: 16776kb

input:

51865 300000 0
1000000000
285
149
375
317
611
65
342
152
428
499
42
194
369
14
464
414
244
317
455
348
349
355
589
575
495
390
405
585
234
331
574
105
520
537
366
465
618
387
374
475
491
62
498
137
548
389
102
587
355
443
136
569
442
58
367
28
287
200
363
501
239
601
375
385
608
571
300
632
294
482
...

output:

945

result:

ok single line: '945'

Test #25:

score: 0
Accepted
time: 39ms
memory: 15756kb

input:

14406 300000 0
144526518
371684135
378793895
173151017
70766484
649335569
581666162
290232378
650388539
523245002
120048489
707409684
3629545
581050976
641071841
526493942
114320488
395559192
498750056
638471151
235185388
374632513
149704572
652257556
649152431
231118677
140674074
458159754
40558394...

output:

698741882

result:

ok single line: '698741882'

Test #26:

score: 0
Accepted
time: 0ms
memory: 7336kb

input:

191 18145 0
1000000000
77
790
2412
687
2410
2436
737
433
1522
1871
2602
381
691
2745
2030
1155
2970
816
487
990
2649
1065
903
2279
1461
2883
587
1021
877
610
2976
1012
2669
1197
190
954
1742
2290
2572
1821
2724
1858
1348
195
1175
101
1579
2093
2311
2178
1839
2300
329
2915
2295
288
2166
333
318
2403
...

output:

12647929

result:

ok single line: '12647929'

Test #27:

score: 0
Accepted
time: 52ms
memory: 15968kb

input:

100000 300000 0
1000000000
14
21
27
27
20
6
17
27
22
9
28
31
14
10
7
24
9
31
11
28
29
7
4
15
7
21
15
14
24
26
26
4
27
7
18
1
19
6
20
23
17
7
3
23
19
24
6
8
30
2
20
29
4
25
17
31
5
2
2
3
2
14
15
30
24
26
3
27
18
14
21
7
14
25
2
17
20
16
3
18
2
3
11
7
18
24
1
21
26
13
28
31
28
24
29
3
3
22
30
24
9
9
1...

output:

-1

result:

ok single line: '-1'

Test #28:

score: 0
Accepted
time: 61ms
memory: 14760kb

input:

90733 232740 0
993699461
3118368
233164
3580558
3671189
2438093
794109
1366356
4036210
3420838
720615
1914088
2152173
3427237
2748056
1481805
2650261
1775133
3529041
1774607
1586636
840051
3061706
559748
2579769
2523998
904248
3230787
2800836
3975958
395174
3679210
3318509
4026427
2192496
3694355
13...

output:

4474392

result:

ok single line: '4474392'

Test #29:

score: 0
Accepted
time: 52ms
memory: 15512kb

input:

60620 300000 0
276963356
27
27
94
9
67
91
60
23
26
42
53
41
72
54
15
68
40
23
59
79
18
79
28
94
77
80
38
73
30
26
59
70
66
3
39
9
57
48
13
17
49
36
31
62
59
66
64
63
34
35
53
65
17
39
88
41
28
27
4
1
69
69
91
89
9
17
62
60
9
66
57
74
16
23
41
82
60
1
4
12
55
40
38
67
19
48
63
21
33
28
83
11
23
71
66...

output:

25129297

result:

ok single line: '25129297'

Test #30:

score: 0
Accepted
time: 29ms
memory: 13552kb

input:

93864 207375 0
1000000000
987
858
122
632
507
380
1113
1008
298
1134
813
822
792
1080
1029
361
1129
955
1076
852
32
123
388
560
866
950
254
734
495
588
978
893
840
475
380
314
872
222
935
622
805
499
62
315
335
696
459
132
358
226
484
819
1018
807
1005
43
300
315
301
1045
129
403
849
1118
598
884
28...

output:

-1

result:

ok single line: '-1'

Test #31:

score: 0
Accepted
time: 8ms
memory: 7896kb

input:

19132 23048 0
665441593
211
228
238
147
88
37
26
93
109
116
206
40
206
280
10
109
157
172
130
120
93
279
187
70
271
152
277
229
306
244
78
149
228
236
189
137
155
51
263
71
195
151
169
206
49
12
267
287
133
293
208
203
34
78
224
131
74
54
99
227
200
50
50
253
132
63
280
124
139
16
14
86
96
123
230
2...

output:

314

result:

ok single line: '314'

Test #32:

score: 0
Accepted
time: 31ms
memory: 12596kb

input:

19001 195093 0
1000000000
94177561
13522119
80987792
12816641
39138650
8411657
81448467
85607497
7594878
17521156
49665721
54162845
30183341
23373830
91897390
30120605
50018211
13425521
88889617
2818327
37586992
64759728
13817036
86623820
89191937
70666594
31580363
80378075
22219072
95800041
3006880...

output:

79284195

result:

ok single line: '79284195'

Test #33:

score: 0
Accepted
time: 7ms
memory: 11380kb

input:

987 149992 0
1000000000
1642
119
581
670
1188
1148
2833
2966
833
1333
1244
2443
2637
1304
1000
576
953
1494
2043
2614
1246
1907
1253
2444
675
2902
1358
1898
1384
713
2943
1269
768
264
2626
141
2740
1323
1334
1742
1043
311
210
2797
2029
14
1347
284
2842
2944
965
1046
412
956
1109
2619
2671
1407
1177
...

output:

847

result:

ok single line: '847'

Test #34:

score: 0
Accepted
time: 50ms
memory: 16116kb

input:

100000 300000 0
1000000000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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:

15939

result:

ok single line: '15939'

Test #35:

score: 0
Accepted
time: 3ms
memory: 7244kb

input:

9508 5631 0
1000000000
44626816
148865683
285096922
131919453
281182151
365923872
72756135
243864585
11908557
319576222
58513662
196192209
345640307
319073910
36847741
72709821
216607942
178633522
140858136
196135967
313555539
368052080
338737547
149023863
232141537
353569491
163495439
41991343
3225...

output:

1020473859092

result:

ok single line: '1020473859092'

Test #36:

score: 0
Accepted
time: 40ms
memory: 15804kb

input:

17591 300000 0
1000000000
203
110
201
32
130
104
66
187
59
38
113
31
134
185
164
200
129
92
97
77
1
1
59
197
78
26
41
156
117
181
161
61
3
8
210
176
18
199
122
113
77
41
151
7
61
82
119
206
204
178
8
85
115
135
204
201
10
173
210
182
106
191
131
127
96
3
141
32
53
131
200
20
134
173
129
56
32
191
67...

output:

163

result:

ok single line: '163'

Test #37:

score: 0
Accepted
time: 6ms
memory: 7648kb

input:

23231 20634 0
1000000000
8752695
9236212
2000645
12785095
8077746
10840198
13324722
16246965
10571386
3818772
8566011
4972548
12617020
534685
2853037
4612414
12673504
16092372
3943611
17192981
15705217
16385843
1497509
14211238
6195606
17140140
9419316
7782206
12640131
4809427
12233103
3182183
36053...

output:

50738101046

result:

ok single line: '50738101046'

Test #38:

score: 0
Accepted
time: 6ms
memory: 7672kb

input:

39465 20214 0
416222450
15313932
16818312
16706667
48998945
50476281
2959637
36383213
22784060
34598367
5668342
48265953
38544679
19906956
16054291
8538040
3081523
13610784
2762939
29165272
21364407
7371702
51585119
9916251
43733475
50509914
6891315
18622334
12382105
39684007
54123004
16898525
51706...

output:

100503158979

result:

ok single line: '100503158979'

Test #39:

score: 0
Accepted
time: 17ms
memory: 10564kb

input:

42990 118356 0
136679485
46
26
71
30
172
120
61
107
141
148
61
136
149
54
42
102
64
4
49
24
108
141
69
161
142
172
84
91
158
164
112
132
38
118
61
66
113
118
89
14
99
7
43
161
113
123
13
74
9
141
156
102
62
68
3
28
91
1
145
147
105
1
96
155
84
122
119
131
64
28
171
165
60
61
63
61
12
23
42
95
117
14...

output:

-1

result:

ok single line: '-1'

Test #40:

score: 0
Accepted
time: 7ms
memory: 7964kb

input:

37813 30008 0
1000000000
36
13
49
46
28
57
28
19
58
42
20
29
56
29
42
25
16
21
37
19
39
47
14
7
49
38
17
36
63
60
18
24
55
13
54
48
53
19
38
3
10
62
47
43
34
6
63
33
14
56
32
51
53
31
31
51
41
16
13
52
48
23
49
38
56
17
28
28
31
15
9
49
52
38
19
36
53
42
25
27
20
50
34
35
35
21
9
55
41
33
8
32
55
11...

output:

137724817

result:

ok single line: '137724817'

Subtask #3:

score: 50
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #41:

score: 50
Accepted
time: 40ms
memory: 14756kb

input:

26876 300000 623545298
623545298
165
155
20
152
29
7
188
122
143
94
149
72
49
211
29
80
181
205
72
172
4
3
22
166
18
126
170
146
98
169
30
156
206
149
32
154
151
1
99
133
168
85
166
33
5
140
94
154
36
90
201
53
6
42
97
25
194
101
6
161
23
112
134
75
173
101
68
147
69
87
25
41
70
22
203
216
181
3
11
...

output:

-1

result:

ok single line: '-1'

Test #42:

score: 0
Accepted
time: 10ms
memory: 8436kb

input:

85981 29342 450724941
509796210
214416
284796
194998
404377
375425
117481
39475
336942
286974
198046
133034
145351
232294
214611
388718
67530
342407
241072
394612
238450
348303
13551
15010
222250
416065
108542
41342
417363
186520
327592
65005
215628
76482
257149
139820
135732
149284
199002
371497
10...

output:

576815306

result:

ok single line: '576815306'

Test #43:

score: 0
Accepted
time: 41ms
memory: 14444kb

input:

49801 269094 79392039
79392039
1
3
2
3
2
1
3
2
2
2
3
2
2
1
1
1
2
3
2
2
3
1
1
2
2
1
2
1
1
3
2
3
1
1
3
2
3
3
1
3
2
1
3
2
1
2
3
1
2
2
3
2
2
2
3
3
2
2
3
2
3
3
2
3
3
3
1
3
2
1
2
3
3
2
2
1
3
1
3
2
3
3
3
1
1
3
1
1
2
2
3
3
1
2
1
3
3
2
3
2
1
2
2
3
3
1
1
2
2
3
3
2
1
3
2
1
1
1
2
1
1
3
2
1
3
1
3
2
2
2
3
1
1
2
3...

output:

79393486

result:

ok single line: '79393486'

Test #44:

score: 0
Accepted
time: 25ms
memory: 10400kb

input:

52746 98032 185494777
1000000000
11315531
5621210
11557362
437998
1740259
9842111
1352838
2874074
4159006
4253331
4917156
7358966
5141089
5649170
15243125
8126540
8609321
244426
9719734
2912082
5344990
9082947
16157871
13132386
4509560
2824424
9852268
9842816
10235713
6703345
15475385
6509528
139445...

output:

183583732

result:

ok single line: '183583732'

Test #45:

score: 0
Accepted
time: 40ms
memory: 14892kb

input:

27232 300000 377714027
1000000000
1813835
1249908
1778784
1806016
1621205
1477374
1790780
1202764
1626724
188969
684559
463165
1555979
482419
1397258
1719872
430472
1628369
1239220
1543109
1667853
1164209
1109906
772042
1545658
525133
1471880
964523
809460
1834911
311269
1509589
92635
713803
413745
...

output:

377281854

result:

ok single line: '377281854'

Test #46:

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

input:

100000 34 403956
403956
339739
659773
129626
236848
621763
658388
470465
808464
851848
899471
936494
414633
440570
506823
612695
898182
141863
610067
476640
610652
331541
114705
430594
5162
698108
536566
561595
127994
552121
359860
437811
634883
26975
421713
302225
397002
838379
53056
231149
685844
...

output:

573354

result:

ok single line: '573354'

Test #47:

score: 0
Accepted
time: 60ms
memory: 14368kb

input:

100000 211769 667774274
933829337
159980032
10697513
176553658
2855431
94852542
16463152
116514710
81763676
114682823
209993160
171796308
175407266
8864351
28252658
209964034
25217328
97878250
98486326
109837458
1636693
95116746
57382482
85434867
28770728
39382463
78038304
152571540
86450608
1244127...

output:

566008992

result:

ok single line: '566008992'

Test #48:

score: 0
Accepted
time: 70ms
memory: 16616kb

input:

100000 300000 252031580
252031580
2
5
3
4
2
2
5
5
6
3
7
2
5
1
5
3
6
5
5
6
5
2
2
1
6
2
5
6
3
5
1
4
1
6
7
1
3
4
5
6
5
2
6
4
3
2
6
3
3
3
7
6
1
1
6
5
3
2
6
3
6
3
1
1
5
1
3
4
2
2
2
5
6
7
7
1
4
5
1
4
4
5
6
1
4
7
1
4
7
7
5
7
2
6
4
4
5
2
2
4
4
1
2
4
6
3
2
5
2
5
1
4
1
4
2
3
1
1
2
1
1
7
1
7
6
1
3
6
4
6
4
4
5
...

output:

252031603

result:

ok single line: '252031603'

Test #49:

score: 0
Accepted
time: 49ms
memory: 14368kb

input:

100000 209869 222149512
570542976
3
2
10
14
3
6
12
3
3
5
10
5
6
1
13
14
10
5
11
13
6
3
15
3
2
10
5
9
14
10
15
14
12
7
13
3
15
13
14
3
7
15
11
4
15
8
11
14
9
13
7
14
1
13
11
10
3
6
7
15
12
15
2
11
8
6
4
4
6
5
5
2
9
7
11
14
1
1
14
11
1
1
15
15
3
6
12
9
6
14
6
7
3
7
14
11
11
10
8
9
5
4
5
11
13
4
2
2
13...

output:

222149534

result:

ok single line: '222149534'

Test #50:

score: 0
Accepted
time: 49ms
memory: 15844kb

input:

45068 300000 1000000000
1000000000
86837087
12059719
75812282
105341988
86108884
39191431
91188315
6202140
74321095
183118085
4652208
178009337
70145578
104435566
33167879
144678201
101451597
139810409
65967059
102633838
59769812
146217778
75018273
29717607
172959476
135366031
52288679
155987079
393...

output:

836890268

result:

ok single line: '836890268'

Test #51:

score: 0
Accepted
time: 9ms
memory: 8056kb

input:

37205 32860 406177526
406177526
8082179
5246151
22378940
2315749
18118889
16795705
2435413
21289699
28750754
1618258
26589536
11978770
9610815
24667468
11179671
29810146
23005942
23177270
9348949
13625033
5685123
12729911
14620409
3106119
25092710
23230160
24687896
6810833
12170132
23535987
20411305...

output:

487462573041

result:

ok single line: '487462573041'

Test #52:

score: 0
Accepted
time: 55ms
memory: 15664kb

input:

45139 296624 1000000000
1000000000
8581
56395
54740
14003
68177
14971
51251
34434
23909
18981
66851
9561
65876
11211
21388
7251
67471
24066
39154
67434
67397
17884
58268
14793
935
24998
12487
17685
5507
944
53952
68530
46675
53073
7392
53592
34289
58802
60541
35747
27492
35553
10938
918
9493
13289
5...

output:

1000057711

result:

ok single line: '1000057711'

Test #53:

score: 0
Accepted
time: 55ms
memory: 15840kb

input:

100000 300000 609813304
609813304
1247
397
728
796
1505
720
162
818
608
1049
111
1324
1391
292
830
516
1354
1012
72
1329
439
790
355
21
783
1473
1657
1127
455
615
838
629
1276
1078
203
719
970
860
340
632
336
492
1048
1192
778
73
316
740
849
413
249
1016
62
730
805
579
436
431
132
1577
305
775
1099
...

output:

-1

result:

ok single line: '-1'

Test #54:

score: 0
Accepted
time: 58ms
memory: 15788kb

input:

76254 300000 1000000000
1000000000
116
18
27
14
117
44
1
84
127
113
128
106
128
88
84
106
50
74
1
105
70
31
121
103
27
128
95
18
26
26
127
102
103
29
124
125
10
116
118
9
111
125
48
40
123
102
47
70
74
123
43
94
1
30
36
62
6
65
45
131
90
76
17
68
115
58
42
79
34
60
113
115
20
94
70
55
56
126
113
71
...

output:

1000197349

result:

ok single line: '1000197349'

Test #55:

score: 0
Accepted
time: 53ms
memory: 15984kb

input:

100000 300000 1000000000
1000000000
1
2
2
1
2
2
2
1
2
1
1
1
1
2
1
1
2
2
1
2
2
2
1
1
1
2
2
2
2
2
1
1
1
1
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
1
1
1
2
2
1
1
2
2
2
2
2
2
1
2
1
2
1
2
1
1
2
2
1
1
2
1
2
1
2
2
2
1
1
1
1
2
2
1
2
1
1
1
1
2
1
2
2
1
2
2
1
1
1
2
1
2
2
2
2
2
1
1
2
2
1
2
2
1
2
2
2
1
1
2
1
2
1
1
2
2
2
1
...

output:

1000000875

result:

ok single line: '1000000875'

Test #56:

score: 0
Accepted
time: 70ms
memory: 16496kb

input:

100000 300000 64240418
337422251
2
8
9
1
2
10
1
11
7
9
5
9
2
1
10
6
9
6
4
5
10
6
2
9
12
10
10
2
5
9
4
3
9
2
11
2
10
8
7
3
11
7
2
10
1
3
4
2
1
9
4
4
11
5
6
8
11
7
1
8
8
8
4
8
6
9
6
12
3
1
9
4
4
1
3
6
5
8
3
7
7
3
6
7
2
7
1
11
1
6
12
7
1
4
1
4
4
6
8
12
8
3
7
1
3
5
7
9
8
10
9
9
3
11
10
3
10
12
7
10
9
9
...

output:

64240438

result:

ok single line: '64240438'

Test #57:

score: 0
Accepted
time: 13ms
memory: 8824kb

input:

100000 47114 95279179
95279179
228427
40968
74492
113448
272199
244900
158583
215664
183127
148673
123000
164328
134889
283721
130635
165657
73535
128901
296477
73149
268419
204343
161023
297018
280655
112032
113466
70239
147966
129379
316257
187972
103965
203227
253528
74439
301368
323744
239272
12...

output:

5655710504

result:

ok single line: '5655710504'

Test #58:

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

input:

5811 5573 1000000000
1000000000
1642
11509
12241
6330
15847
9995
11709
4783
4513
18159
5999
4895
13826
3232
3182
14296
2846
7745
2778
2917
2791
17170
248
2595
14252
11337
8479
17084
8687
4987
7941
11487
1412
932
11047
6107
13269
18222
18551
8629
8952
18463
11325
2035
11301
4834
11476
13085
3135
2144...

output:

1020022905

result:

ok single line: '1020022905'

Test #59:

score: 0
Accepted
time: 50ms
memory: 15712kb

input:

82869 300000 216626705
216626705
1
1
1
2
1
1
1
2
2
1
2
1
2
2
2
1
1
1
1
1
1
1
1
1
2
1
2
2
2
1
1
1
1
1
2
2
1
2
1
1
2
1
1
2
1
2
2
1
1
1
2
1
1
1
2
1
2
2
2
1
2
2
1
2
2
2
1
2
1
1
2
1
1
2
2
1
2
2
1
1
2
1
1
1
1
2
2
2
1
2
2
1
1
2
1
1
1
2
2
2
2
2
1
1
1
1
2
2
1
1
2
1
1
1
2
2
2
2
1
2
2
1
2
1
1
2
2
1
1
1
2
2
2
2...

output:

-1

result:

ok single line: '-1'

Test #60:

score: 0
Accepted
time: 7ms
memory: 8596kb

input:

100000 39936 221108075
1000000000
1062337
2349102
15769542
9858167
10704986
10036965
9593423
15741802
15376724
1678227
10896398
3439189
16071157
13573503
7095118
10561143
4498689
7470542
16672073
11843576
15534852
9464734
11643336
6508121
5211242
10343176
2706518
4150437
14635089
7932297
7684210
107...

output:

28775982824

result:

ok single line: '28775982824'

Extra Test:

score: 0
Extra Test Passed