QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#424103#8109. PostcardsGuanYunchangAC ✓617ms50324kbC++172.1kb2024-05-28 21:51:462024-05-28 21:51:46

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 5988kb

input:

4 4 3
1 2
4 3
2 3
1 3
2
3 1 1
1 0 1
3
1 1 0
0 1 0
3 1 0
1
1 1 1

output:

3
1
0

result:

ok 3 number(s): "3 1 0"

Test #2:

score: 0
Accepted
time: 178ms
memory: 40924kb

input:

3000 11860 5000
135 1279
1379 1627
1253 2516
338 1596
260 1086
1153 2182
527 732
500 2820
1395 1556
793 1491
2673 2746
1630 1792
1720 2871
443 2095
1095 1296
2008 2358
1685 1801
2356 2704
1856 2698
1798 2134
1683 1792
812 2977
43 1507
1297 1574
222 1563
1278 2168
1181 1851
1492 2757
432 1459
428 902...

output:

3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
2999
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
3000
...

result:

ok 5000 numbers

Test #3:

score: 0
Accepted
time: 141ms
memory: 44532kb

input:

2430 490875 33333
2 1
3 1
3 2
4 1
4 2
4 3
5 1
5 2
5 3
5 4
6 1
6 2
6 3
6 4
6 5
7 1
7 2
7 3
7 4
7 5
7 6
8 1
8 2
8 3
8 4
8 5
8 6
8 7
9 1
9 2
9 3
9 4
9 5
9 6
9 7
9 8
10 1
10 2
10 3
10 4
10 5
10 6
10 7
10 8
10 9
11 1
11 2
11 3
11 4
11 5
11 6
11 7
11 8
11 9
11 10
12 1
12 2
12 3
12 4
12 5
12 6
12 7
12 8
12...

output:

405
405
2430
405
2430
2430
1620
405
2430
2430
405
405
405
1620
2025
405
405
2025
0
405
405
405
405
405
2430
405
405
405
1620
405
405
1620
2430
2430
2430
405
2430
405
2430
1620
405
405
405
2430
1215
2025
2430
405
2025
2430
2430
1620
0
405
405
1215
405
2430
405
0
2430
405
405
0
2430
405
1215
405
2430
...

result:

ok 33333 numbers

Test #4:

score: 0
Accepted
time: 140ms
memory: 41888kb

input:

2225 493960 50000
2 1
3 1
3 2
4 1
4 2
4 3
5 1
5 2
5 3
5 4
6 1
6 2
6 3
6 4
6 5
7 1
7 2
7 3
7 4
7 5
7 6
8 1
8 2
8 3
8 4
8 5
8 6
8 7
9 1
9 2
9 3
9 4
9 5
9 6
9 7
9 8
10 1
10 2
10 3
10 4
10 5
10 6
10 7
10 8
10 9
11 1
11 2
11 3
11 4
11 5
11 6
11 7
11 8
11 9
11 10
12 1
12 2
12 3
12 4
12 5
12 6
12 7
12 8
12...

output:

2225
2225
445
445
445
445
445
1780
2225
445
1780
1780
1335
2225
2225
2225
1780
445
445
445
2225
445
445
445
445
2225
2225
445
0
1780
445
445
445
445
445
445
1780
445
2225
445
445
0
445
445
2225
0
445
445
445
0
1780
0
445
445
445
0
445
2225
445
2225
2225
445
2225
445
0
445
2225
0
2225
445
2225
445
22...

result:

ok 50000 numbers

Test #5:

score: 0
Accepted
time: 150ms
memory: 44988kb

input:

2625 490896 23809
2 1
3 1
3 2
4 1
4 2
4 3
5 1
5 2
5 3
5 4
6 1
6 2
6 3
6 4
6 5
7 1
7 2
7 3
7 4
7 5
7 6
8 1
8 2
8 3
8 4
8 5
8 6
8 7
9 1
9 2
9 3
9 4
9 5
9 6
9 7
9 8
10 1
10 2
10 3
10 4
10 5
10 6
10 7
10 8
10 9
11 1
11 2
11 3
11 4
11 5
11 6
11 7
11 8
11 9
11 10
12 1
12 2
12 3
12 4
12 5
12 6
12 7
12 8
12...

output:

2625
375
2625
2250
1125
375
375
375
0
2250
375
1875
1125
2625
375
375
2625
1875
2625
2625
2250
2625
2250
375
375
375
2250
2625
2625
1875
2625
375
0
375
2625
2625
2625
2625
375
375
375
2625
375
375
2625
375
375
375
2250
375
2625
1125
1125
375
375
2625
2625
0
375
2625
375
375
0
2625
375
375
2625
2625
...

result:

ok 23809 numbers

Test #6:

score: 0
Accepted
time: 151ms
memory: 41296kb

input:

3000 3000 250000
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
...

output:

407
687
1378
2124
15
1126
78
1253
990
2020
2664
1455
1888
1494
1448
2467
2995
2193
1673
2823
90
1836
2565
2990
1604
239
429
2943
812
498
1956
829
1164
1329
1703
1578
753
2550
2302
1961
1264
2612
1763
2379
1337
1509
673
1609
2489
643
1736
2003
128
1388
1283
432
2606
931
2283
1695
753
2088
363
1084
46...

result:

ok 250000 numbers

Test #7:

score: 0
Accepted
time: 139ms
memory: 42700kb

input:

3000 13800 250000
2 1
3 1
3 2
4 1
4 2
4 3
5 1
5 2
5 3
5 4
6 1
6 2
6 3
6 4
6 5
7 1
7 2
7 3
7 4
7 5
7 6
8 1
8 2
8 3
8 4
8 5
8 6
8 7
9 1
9 2
9 3
9 4
9 5
9 6
9 7
9 8
10 1
10 2
10 3
10 4
10 5
10 6
10 7
10 8
10 9
12 11
13 11
13 12
14 11
14 12
14 13
15 11
15 12
15 13
15 14
16 11
16 12
16 13
16 14
16 15
17 ...

output:

260
780
1360
2090
2650
930
2390
2790
2650
1970
1390
510
930
2390
620
2500
50
690
1210
1990
330
1200
2950
2880
630
1740
920
320
20
1700
570
2320
2900
1810
2950
70
850
440
570
1540
470
1400
2770
10
680
1150
1450
380
390
1880
130
340
1170
1980
2550
2360
1920
70
1010
450
2540
1030
2650
260
1010
1020
650...

result:

ok 250000 numbers

Test #8:

score: 0
Accepted
time: 181ms
memory: 50324kb

input:

3000 448510 250000
2 1
3 1
3 2
4 1
4 2
4 3
5 1
5 2
5 3
5 4
6 1
6 2
6 3
6 4
6 5
7 1
7 2
7 3
7 4
7 5
7 6
8 1
8 2
8 3
8 4
8 5
8 6
8 7
9 1
9 2
9 3
9 4
9 5
9 6
9 7
9 8
10 1
10 2
10 3
10 4
10 5
10 6
10 7
10 8
10 9
11 1
11 2
11 3
11 4
11 5
11 6
11 7
11 8
11 9
11 10
12 1
12 2
12 3
12 4
12 5
12 6
12 7
12 8
1...

output:

300
2700
1500
300
2700
2700
2100
1500
2400
600
2100
2700
2100
1200
2100
300
600
2700
1500
2700
600
300
1800
1500
2700
900
2700
300
1200
1500
1200
2100
1200
1500
900
2400
1200
2100
2100
2700
1800
1200
900
1200
2100
2700
2100
2100
1500
300
2400
2700
1200
1800
600
2100
2100
2700
600
2100
600
1800
300
2...

result:

ok 250000 numbers

Test #9:

score: 0
Accepted
time: 87ms
memory: 40328kb

input:

2800 9200 41666
2 1
3 1
3 2
4 1
4 2
4 3
5 1
5 2
5 3
5 4
6 1
6 2
6 3
6 4
6 5
7 1
7 2
7 3
7 4
7 5
7 6
9 8
10 8
10 9
11 8
11 9
11 10
12 8
12 9
12 10
12 11
13 8
13 9
13 10
13 11
13 12
14 8
14 9
14 10
14 11
14 12
14 13
16 15
17 15
17 16
18 15
18 16
18 17
19 15
19 16
19 17
19 18
20 15
20 16
20 17
20 18
20...

output:

21
14
21
28
42
7
63
14
28
21
14
63
63
63
14
14
14
7
21
42
21
14
63
28
14
14
42
42
21
21
7
21
28
21
42
42
28
42
42
28
63
28
14
7
42
14
21
42
42
28
42
7
42
42
14
28
63
28
14
28
14
42
14
42
63
42
14
7
42
14
28
14
21
7
21
42
7
28
28
14
21
21
63
21
42
14
42
14
28
63
21
42
7
42
63
42
14
7
42
63
21
21
7
14...

result:

ok 41666 numbers

Test #10:

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

input:

2940 20972 15625
2 1
3 1
3 2
4 1
4 2
4 3
5 1
5 2
5 3
5 4
6 1
6 2
6 3
6 4
6 5
7 1
7 2
7 3
7 4
7 5
7 6
8 1
8 2
8 3
8 4
8 5
8 6
8 7
9 1
9 2
9 3
9 4
9 5
9 6
9 7
9 8
10 1
10 2
10 3
10 4
10 5
10 6
10 7
10 8
10 9
11 1
11 2
11 3
11 4
11 5
11 6
11 7
11 8
11 9
11 10
12 1
12 2
12 3
12 4
12 5
12 6
12 7
12 8
12 ...

output:

90
480
150
525
60
840
300
600
960
240
60
525
420
90
75
90
60
360
960
450
120
150
225
75
525
75
840
120
60
150
360
420
300
300
105
375
360
90
270
15
180
360
360
630
420
60
225
60
360
240
60
525
360
600
90
180
90
210
360
540
180
30
90
60
180
180
120
525
480
630
105
600
60
525
15
210
90
315
525
120
420...

result:

ok 15625 numbers

Test #11:

score: 0
Accepted
time: 112ms
memory: 40612kb

input:

2809 5618 5000
1 54
1 2
2 55
2 3
3 56
3 4
4 57
4 5
5 58
5 6
6 59
6 7
7 60
7 8
8 61
8 9
9 62
9 10
10 63
10 11
11 64
11 12
12 65
12 13
13 66
13 14
14 67
14 15
15 68
15 16
16 69
16 17
17 70
17 18
18 71
18 19
19 72
19 20
20 73
20 21
21 74
21 22
22 75
22 23
23 76
23 24
24 77
24 25
25 78
25 26
26 79
26 27...

output:

9
46
10
250
240
81
408
84
484
175
63
48
57
154
8
198
84
350
18
308
50
285
114
368
54
196
55
336
30
72
120
192
76
260
368
108
250
108
255
56
170
320
8
336
4
198
200
120
252
255
10
30
625
48
9
30
500
150
30
168
418
112
576
247
18
30
253
414
65
462
216
60
352
72
380
84
6
28
42
170
437
25
400
182
170
22...

result:

ok 5000 numbers

Test #12:

score: 0
Accepted
time: 80ms
memory: 8372kb

input:

20 100 12500
7 12
14 16
3 8
1 16
5 13
9 16
2 18
10 20
9 12
1 6
5 17
11 15
6 16
4 11
1 12
5 15
6 14
4 10
12 13
5 20
3 19
11 13
13 20
17 20
4 18
9 10
2 19
6 15
13 15
6 10
3 18
2 20
15 16
4 9
5 14
3 20
4 5
5 19
18 19
4 15
16 17
17 18
9 15
10 16
14 19
5 16
2 5
3 10
1 11
8 9
3 6
5 12
13 14
1 4
2 15
7 14
...

output:

20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
...

result:

ok 12500 numbers

Test #13:

score: 0
Accepted
time: 95ms
memory: 6548kb

input:

8 7 100000
4 2
7 6
8 6
6 1
3 2
5 2
2 1
5
0 0 1
1 0 1
3 0 1
4 0 1
5 0 1
5
5 0 1
6 0 1
0 1 0
1 0 1
2 1 0
5
6 0 1
0 1 0
1 0 1
2 1 0
3 0 1
5
5 0 1
6 0 1
0 0 1
1 0 1
3 0 1
5
3 1 0
4 0 1
5 0 1
6 0 1
0 0 1
5
2 0 1
4 0 1
5 0 1
6 1 0
0 0 1
5
2 0 1
3 0 1
4 1 0
5 1 0
6 0 1
5
1 0 1
2 0 1
3 0 1
5 0 1
6 1 0
5
0 0...

output:

2
0
0
3
0
1
0
1
0
3
0
3
3
0
0
2
0
1
2
2
0
3
0
0
1
0
1
0
3
0
3
0
3
0
3
0
2
1
2
2
1
3
3
3
1
3
1
1
1
3
3
0
2
3
0
3
2
0
3
1
1
1
0
1
0
3
0
3
1
2
1
0
2
1
3
3
0
0
1
3
3
0
1
0
2
3
0
1
0
3
2
3
3
2
2
2
0
1
1
1
0
3
1
1
2
2
2
2
0
1
3
1
3
3
0
1
0
1
3
1
3
2
2
3
3
3
1
0
2
0
1
0
2
0
3
1
3
1
3
3
3
2
0
0
1
0
3
3
0
1
...

result:

ok 100000 numbers

Test #14:

score: 0
Accepted
time: 160ms
memory: 40968kb

input:

3000 2999 100000
32 23
1819 1600
1795 530
263 65
2688 1258
540 186
835 75
2780 1758
1483 753
859 394
387 97
100 56
616 199
824 136
1633 834
2086 789
1582 60
733 309
47 29
545 237
2418 1559
966 250
1032 929
1590 600
1980 983
2378 325
1504 1309
2583 1446
2510 976
2631 1099
1278 1264
2643 331
151 59
13...

output:

2901
2979
2944
2988
2986
2990
2992
2981
2994
2994
2991
2993
2988
2995
2993
2990
2976
2968
2967
2989
2993
2968
2984
2991
2991
2990
2990
2988
2981
2992
2991
2989
2995
2989
2978
2983
2922
2985
2991
2980
2993
2978
2985
2995
2975
2990
2986
2990
2979
2935
2990
2986
2993
2983
2979
2993
2971
2934
2993
2994
...

result:

ok 100000 numbers

Test #15:

score: 0
Accepted
time: 272ms
memory: 40444kb

input:

2999 2998 17857
2123 1486
1916 1560
1615 335
948 870
453 88
818 350
2502 1982
2819 1992
1333 711
1436 1282
397 362
1314 525
2926 564
94 90
2835 1610
2994 1891
2011 325
1844 211
1186 4
2006 221
1832 1700
2763 2518
607 348
2483 1077
449 352
2241 1457
2317 2149
1250 886
2180 850
1162 73
1142 1054
1118 ...

output:

2843
2826
2914
1
2717
2881
2584
2903
2727
2932
2840
1
2789
2863
2902
2913
26
2830
2317
2889
2909
2888
2876
2934
11
2853
2565
2910
2919
2937
2748
2904
2884
2922
2895
2876
2855
2703
2889
2716
2945
2769
2916
2901
2829
2875
2726
2939
2939
2769
2902
2261
2778
2924
2698
2346
2932
2898
2683
2766
2297
2809
...

result:

ok 17857 numbers

Test #16:

score: 0
Accepted
time: 617ms
memory: 39528kb

input:

2999 2998 5000
1095 1092
624 381
1167 916
2307 1155
1976 1067
584 282
2978 936
1383 247
481 279
1185 1015
2097 2008
2268 2080
393 217
1528 1417
1590 1009
1353 66
1054 370
526 169
1790 591
2287 2129
1959 855
2679 2364
903 654
256 101
752 595
1683 904
2494 485
236 64
2796 1904
2037 1038
2396 934
2898 ...

output:

12
2331
1600
2487
2530
1970
2388
2627
2525
2728
2445
2394
2588
2263
940
1895
2332
2393
2549
0
2551
914
2361
2366
0
0
1
2311
1
2261
2605
2300
2650
2306
2528
2568
2640
2311
2466
2512
2527
2197
4
4
2374
1867
2690
2003
8
2508
2272
2728
1
8
3
1568
904
2455
1
2246
2259
2707
2628
2287
1
1637
0
2556
2409
0
...

result:

ok 5000 numbers