QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#640738#1401. Making Friends is FunNova_NightWind0311100 ✓42ms12180kbC++201.3kb2024-10-14 15:40:052024-10-14 15:40:05

详细

Subtask #1:

score: 5
Accepted

Test #1:

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

input:

1 0

output:

0

result:

ok single line: '0'

Test #2:

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

input:

2 1
2 1

output:

1

result:

ok single line: '1'

Test #3:

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

input:

3 2
2 1
2 3

output:

4

result:

ok single line: '4'

Test #4:

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

input:

13 12
1 2
2 3
3 4
1 5
5 6
6 7
7 8
8 9
9 10
11 1
12 11
13 11

output:

77

result:

ok single line: '77'

Test #5:

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

input:

100 100
78 82
67 85
2 22
88 36
16 50
78 11
53 64
7 68
71 48
27 94
82 22
9 57
35 65
78 70
81 86
22 42
37 19
50 64
98 70
78 31
62 41
33 9
7 100
57 13
71 93
93 15
50 46
66 36
64 62
70 79
17 57
81 74
98 87
62 19
56 10
2 7
10 71
14 25
1 47
39 75
96 3
22 50
57 53
56 30
92 11
58 90
87 99
65 90
85 95
100 25...

output:

3121

result:

ok single line: '3121'

Test #6:

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

input:

99 33
27 26
97 35
83 28
71 76
49 75
55 35
1 83
85 70
68 2
49 69
4 46
22 51
38 52
87 21
87 27
82 46
91 88
49 61
25 7
6 99
77 83
62 36
65 33
29 16
64 54
63 70
14 95
69 80
58 87
85 60
45 71
45 78
11 44

output:

56

result:

ok single line: '56'

Test #7:

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

input:

100 300
32 54
22 81
16 72
62 15
41 2
5 81
55 54
33 36
40 42
56 25
98 64
60 52
17 25
46 78
71 32
52 15
84 36
11 50
91 2
54 30
71 84
49 83
78 69
86 22
52 98
57 56
48 40
16 19
16 22
56 35
58 94
4 57
16 25
65 61
98 69
47 69
44 86
17 36
64 42
64 97
100 61
57 81
65 87
81 87
79 12
31 90
3 85
51 34
81 1
40 ...

output:

9514

result:

ok single line: '9514'

Test #8:

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

input:

100 3000
57 50
4 36
78 39
65 50
48 86
11 90
16 47
72 92
37 19
58 19
14 64
83 9
12 59
69 38
20 75
42 88
5 84
6 98
62 31
82 1
67 80
52 17
77 55
60 81
25 49
45 78
28 10
32 77
57 21
53 62
1 40
75 97
21 37
8 38
7 22
11 83
85 56
90 53
93 8
41 34
44 25
66 42
20 82
35 69
24 21
45 54
66 93
35 96
8 94
45 71
2...

output:

9900

result:

ok single line: '9900'

Test #9:

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

input:

100 1000
35 88
50 96
81 11
64 100
99 52
25 78
36 68
34 52
20 9
61 76
71 11
64 41
51 74
2 78
78 86
29 70
44 34
83 9
94 92
60 29
33 95
19 91
33 1
55 78
81 35
36 22
17 90
73 5
40 68
44 86
7 98
56 66
29 17
4 36
15 34
39 97
95 68
94 98
46 45
43 3
32 23
60 79
81 86
83 46
52 37
15 83
56 32
79 47
9 39
24 73...

output:

9900

result:

ok single line: '9900'

Test #10:

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

input:

100 300
13 32
15 27
98 61
4 41
95 39
83 61
7 12
48 67
86 6
79 96
15 74
68 11
1 6
25 1
74 1
8 38
62 100
69 28
40 72
32 26
59 87
13 45
19 29
54 22
90 67
70 96
49 98
24 14
56 35
89 59
1 81
44 26
45 92
68 65
52 78
58 25
50 74
97 66
23 100
58 22
48 94
86 44
86 3
35 19
77 12
65 68
21 63
95 87
15 29
6 23
4...

output:

9514

result:

ok single line: '9514'

Test #11:

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

input:

100 120
10 95
23 51
4 41
37 69
26 97
24 92
3 52
39 7
29 50
6 69
99 3
20 30
74 55
2 68
88 83
1 54
32 90
58 65
62 35
63 58
8 6
33 61
56 32
91 64
72 86
89 15
12 61
53 46
34 63
7 38
30 40
92 98
67 25
36 57
51 67
10 65
37 97
21 46
58 59
31 47
82 51
38 24
29 88
5 58
82 62
59 86
74 95
28 68
96 85
21 33
86 ...

output:

5143

result:

ok single line: '5143'

Test #12:

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

input:

100 100
7 8
86 87
74 75
92 93
94 95
40 41
18 19
54 55
100 1
80 81
89 90
6 7
76 77
51 52
11 12
25 26
28 29
27 28
36 37
17 18
29 30
14 15
97 98
96 97
55 56
33 34
72 73
48 49
99 100
45 46
83 84
46 47
15 16
22 23
69 70
8 9
71 72
87 88
65 66
58 59
12 13
68 69
16 17
37 38
73 74
62 63
50 51
23 24
38 39
77 ...

output:

100

result:

ok single line: '100'

Test #13:

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

input:

100 101
7 8
86 87
74 75
92 93
94 95
40 41
18 19
54 55
100 1
80 81
89 90
6 7
76 77
51 52
11 12
25 26
28 29
27 28
36 37
17 18
29 30
14 15
97 98
96 97
55 56
33 34
72 73
48 49
99 100
45 46
83 84
46 47
15 16
22 23
69 70
8 9
71 72
87 88
65 66
58 59
12 13
68 69
16 17
37 38
73 74
62 63
50 51
23 24
38 39
77 ...

output:

9900

result:

ok single line: '9900'

Test #14:

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

input:

100 99
27 46
25 82
1 17
56 78
9 59
18 19
2 5
4 48
25 54
5 8
49 83
40 93
15 30
14 71
15 73
31 60
36 39
14 77
4 35
25 72
32 97
8 12
2 11
1 6
6 87
1 96
1 43
48 50
22 26
15 36
9 25
3 34
39 58
25 70
13 69
12 24
20 49
17 100
15 51
2 7
47 62
15 28
81 85
12 23
33 84
18 22
50 76
54 91
26 64
21 42
12 20
8 55
...

output:

9709

result:

ok single line: '9709'

Test #15:

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

input:

100 99
82 13
90 42
60 39
96 47
100 45
65 20
57 34
93 90
75 6
9 3
85 9
36 24
50 40
15 14
40 16
80 50
45 2
3 1
97 39
20 16
26 24
86 58
2 1
55 27
7 2
89 10
77 23
31 18
84 63
56 26
59 40
39 29
4 1
88 74
37 21
5 4
92 80
19 2
94 74
44 10
23 5
76 13
41 10
30 17
51 25
61 2
48 12
22 13
62 61
14 9
12 9
17 15
...

output:

99

result:

ok single line: '99'

Test #16:

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

input:

100 99
3 35
61 10
66 76
36 34
74 45
11 22
32 41
43 19
3 2
37 51
7 5
17 13
13 10
31 38
9 52
49 6
29 69
55 20
19 34
9 19
87 10
2 1
50 7
40 70
45 84
20 26
57 49
95 31
91 96
6 4
3 75
23 47
97 92
79 81
17 40
10 20
83 54
89 53
53 39
15 79
66 60
8 10
7 11
31 30
18 1
45 4
43 73
33 17
86 43
17 59
24 94
7 14
...

output:

3254

result:

ok single line: '3254'

Test #17:

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

input:

100 99
7 8
86 87
74 75
92 93
94 95
40 41
18 19
54 55
80 81
89 90
6 7
76 77
51 52
11 12
25 26
28 29
27 28
36 37
17 18
29 30
14 15
97 98
96 97
55 56
33 34
72 73
48 49
99 100
45 46
83 84
46 47
15 16
22 23
69 70
8 9
71 72
87 88
65 66
58 59
12 13
68 69
16 17
37 38
73 74
62 63
50 51
23 24
38 39
77 78
3 4
...

output:

99

result:

ok single line: '99'

Test #18:

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

input:

100 99
7 8
54 55
73 72
35 34
66 65
32 31
42 43
15 14
90 89
80 81
77 76
6 7
84 85
11 12
25 26
35 36
74 73
3 2
16 15
29 30
82 81
50 49
49 48
42 41
17 18
56 55
67 68
91 90
41 40
8 9
60 61
95 94
11 10
58 59
12 13
93 94
38 37
28 27
96 97
5 4
48 47
19 18
52 51
66 67
23 24
70 69
38 39
77 78
71 72
89 88
57 ...

output:

5025

result:

ok single line: '5025'

Subtask #2:

score: 30
Accepted

Dependency #1:

100%
Accepted

Test #19:

score: 30
Accepted
time: 2ms
memory: 6000kb

input:

5000 5000
815 2811
2070 4026
1974 2743
2353 4617
827 1525
1644 3034
1816 4133
1885 685
3293 3417
424 1749
194 4570
1417 4465
4339 374
2801 3594
2298 1368
435 1409
3400 1178
1771 13
3473 466
3567 632
3474 1164
4825 4671
252 266
765 2036
649 3695
1583 714
4708 1054
1893 4025
182 3849
4180 2844
379 799...

output:

7957355

result:

ok single line: '7957355'

Test #20:

score: 30
Accepted
time: 1ms
memory: 6028kb

input:

4999 2000
1282 70
1107 1670
4832 3309
4030 3062
3350 3396
3019 3105
4799 1976
3242 1505
1383 320
893 4336
2399 2369
2627 3208
2377 2624
1321 4987
321 278
4734 4675
2066 1669
4477 4287
3000 4131
4896 460
1837 2630
3946 3925
1150 400
1871 3282
135 2102
3297 1099
4634 1548
2674 4355
3853 3789
3045 1296...

output:

7730

result:

ok single line: '7730'

Test #21:

score: 30
Accepted
time: 0ms
memory: 6368kb

input:

5000 20000
3705 3530
4059 4759
1208 1256
544 3413
1581 45
1968 446
717 2394
2053 2317
1653 3139
1705 3133
2340 2903
2227 2441
3349 3301
1043 1302
4170 3546
593 2701
3251 43
4180 3899
3797 4915
2232 936
4852 4932
3607 2922
4562 4816
3737 3032
295 1170
2681 76
3859 2757
4665 1658
2510 1594
3870 4607
2...

output:

23976119

result:

ok single line: '23976119'

Test #22:

score: 30
Accepted
time: 17ms
memory: 4932kb

input:

5000 143412
2040 4873
303 3660
1111 3301
2810 2385
2807 4683
4217 3288
1577 897
403 4722
2121 2551
1386 879
3495 3539
2448 363
3581 4312
143 36
3624 3867
4375 3193
2385 1938
3385 506
2040 3936
3646 224
2844 3446
2459 1808
4575 3658
1332 1875
3402 1182
4615 3100
1265 336
282 3923
2101 4284
2385 2276
...

output:

24995000

result:

ok single line: '24995000'

Test #23:

score: 30
Accepted
time: 14ms
memory: 4880kb

input:

4999 111555
464 1905
1612 3234
3167 2717
3230 2037
3322 1914
2445 4654
4752 3508
1618 4859
4783 4252
3628 516
4800 3751
3043 1296
4145 3492
787 275
2459 439
4753 2876
3457 3148
4825 1462
1146 2678
3454 2979
4732 2543
1245 2914
1028 2840
3274 1975
1350 3564
4576 1603
928 2685
2150 4720
3072 3708
1229...

output:

24985002

result:

ok single line: '24985002'

Test #24:

score: 30
Accepted
time: 20ms
memory: 7328kb

input:

5000 200000
1436 4100
3799 1788
3269 3985
2694 1910
2404 827
4179 4504
3919 1003
3077 282
4157 792
4455 2347
2658 3933
1079 3045
2120 621
3377 2559
3722 1744
1225 4188
4364 549
541 34
1258 564
1977 2894
2535 1566
4512 3287
3579 3456
1828 1917
22 761
4490 971
4087 4927
3725 3352
4073 4226
4995 874
74...

output:

24995000

result:

ok single line: '24995000'

Test #25:

score: 30
Accepted
time: 1ms
memory: 5916kb

input:

980 2500
5 4
11 4
10 7
8 11
6 2
4 2
6 1
10 2
20 25
19 24
15 33
29 15
27 20
23 26
21 30
20 17
13 14
20 26
29 18
24 18
20 32
30 28
33 17
33 24
15 17
31 33
29 31
19 13
22 25
21 15
19 17
18 24
14 26
17 15
13 34
17 28
21 14
17 32
18 14
29 24
31 13
30 23
37 49
41 47
56 57
41 59
44 49
40 58
56 40
49 39
42 ...

output:

128806

result:

ok single line: '128806'

Test #26:

score: 30
Accepted
time: 3ms
memory: 6216kb

input:

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

output:

221834

result:

ok single line: '221834'

Test #27:

score: 30
Accepted
time: 0ms
memory: 6292kb

input:

999 32768
67 248
158 193
188 60
180 313
308 246
77 328
238 115
332 204
63 76
67 137
214 232
289 135
5 195
190 65
295 61
191 232
249 259
123 174
188 217
270 217
293 344
241 31
80 155
62 31
51 298
228 96
180 206
109 32
35 339
293 297
138 46
204 244
155 280
156 119
269 304
108 344
71 100
165 239
95 98
...

output:

543906

result:

ok single line: '543906'

Test #28:

score: 30
Accepted
time: 7ms
memory: 6532kb

input:

5000 50000
4335 3771
2414 1073
1347 769
4295 4000
1472 3097
148 3935
330 3142
4509 1544
896 3377
2305 956
2201 835
3615 2050
3461 4419
3154 4823
4072 3950
3757 3853
2151 3483
2074 1878
3128 3173
274 228
938 143
1034 2382
4283 3062
1637 4640
2479 1577
2373 470
68 1524
4351 3327
4149 3749
2712 2761
93...

output:

24995000

result:

ok single line: '24995000'

Test #29:

score: 30
Accepted
time: 23ms
memory: 5436kb

input:

5000 200000
3397 4100
2005 2645
164 1394
2895 3070
3559 1319
4277 894
1079 256
3191 4548
1797 4713
1428 3927
3275 401
2781 1556
4662 3226
1956 4302
1378 1034
1685 2565
847 3459
4135 598
3811 2916
1183 4063
3049 2189
2647 1488
4113 3916
4376 4391
3780 4488
3016 310
1328 4765
2070 329
678 2744
3150 47...

output:

24995000

result:

ok single line: '24995000'

Test #30:

score: 30
Accepted
time: 3ms
memory: 4064kb

input:

5000 15000
3830 1911
2442 4201
810 3728
2937 472
132 420
2916 2363
3059 4165
4948 4189
4564 4454
798 2213
2516 4741
4953 2965
4845 2399
1831 2126
3263 688
3340 339
1729 3720
778 724
3907 869
4129 3381
4870 4522
2400 4400
878 4037
3997 3306
4159 1839
2798 3512
4961 2852
3450 875
4944 4570
4129 1674
2...

output:

22682128

result:

ok single line: '22682128'

Test #31:

score: 30
Accepted
time: 1ms
memory: 4032kb

input:

5000 5000
890 2744
3392 768
2458 3553
711 4803
4234 103
4038 2443
3023 2954
3031 20
274 4144
4870 3513
4887 3573
911 1032
3437 3763
2443 4632
4367 4558
3325 3951
313 3133
684 343
4417 3924
3817 4570
612 1162
732 2577
4519 3226
652 2061
2728 1355
580 4932
509 874
3562 3948
1663 2065
2551 2758
3539 17...

output:

8082198

result:

ok single line: '8082198'

Test #32:

score: 30
Accepted
time: 2ms
memory: 6076kb

input:

5000 4000
3555 2072
4319 326
1474 4318
3094 2199
683 2629
4579 1696
1159 3622
4540 3574
4448 2668
3225 3693
687 1030
1792 1424
3293 2690
3420 3678
1044 562
4889 4383
395 1220
143 2032
4596 3536
460 565
1553 677
1924 3431
4822 3911
2226 1132
1040 2852
3968 2840
4164 4311
3253 2984
1882 4150
443 1319
...

output:

5602649

result:

ok single line: '5602649'

Test #33:

score: 30
Accepted
time: 2ms
memory: 6192kb

input:

4999 10000
3434 4232
118 4822
3005 446
2908 4668
2936 2821
4711 4921
68 4546
3502 1769
4818 2106
1069 362
558 1085
3421 2023
1476 4804
3488 3538
426 2590
4252 2383
564 4354
2686 1715
4994 3256
4080 4039
1723 4410
951 4444
1207 4086
1581 926
4007 4318
4145 547
4151 4672
1522 2492
802 4313
2015 2012
3...

output:

18780533

result:

ok single line: '18780533'

Test #34:

score: 30
Accepted
time: 2ms
memory: 6528kb

input:

5000 32000
3225 1214
4716 2350
2826 1235
4833 1234
520 4349
3892 1782
1805 1462
626 3392
2395 3937
4922 756
2832 2655
3269 4971
3263 688
2393 4199
4556 3153
1975 2002
3735 2326
4459 3750
4419 3087
4241 71
569 3442
141 4517
447 4600
3598 2229
2317 1204
4849 827
449 4812
1740 914
1636 4911
819 2363
37...

output:

24885192

result:

ok single line: '24885192'

Test #35:

score: 30
Accepted
time: 15ms
memory: 7272kb

input:

5000 200000
1391 1066
247 3998
2094 4831
1841 2524
1166 4382
736 1785
2591 1701
3761 4596
4392 2346
3476 3945
1208 1367
4511 4537
3873 1071
301 4255
4336 3657
254 622
1649 4692
3487 524
2265 4882
1590 39
3760 3239
1925 2070
1453 4713
801 2017
758 2531
2810 86
633 1502
4236 1755
1179 4471
664 4742
20...

output:

24995000

result:

ok single line: '24995000'

Test #36:

score: 30
Accepted
time: 1ms
memory: 6124kb

input:

5000 5000
3929 3930
566 567
2235 2236
4191 4192
4768 4769
1692 1693
4421 4422
2020 2021
3307 3308
1480 1481
4712 4713
4199 4200
1246 1247
4521 4522
4856 4857
1482 1483
735 736
2066 2067
1312 1313
336 337
1904 1905
1896 1897
2616 2617
2608 2609
1718 1719
468 469
1271 1272
2307 2308
2662 2663
2557 255...

output:

5000

result:

ok single line: '5000'

Test #37:

score: 30
Accepted
time: 1ms
memory: 6200kb

input:

5000 5001
3929 3930
566 567
2235 2236
4191 4192
4768 4769
1692 1693
4421 4422
2020 2021
3307 3308
1480 1481
4712 4713
4199 4200
1246 1247
4521 4522
4856 4857
1482 1483
735 736
2066 2067
1312 1313
336 337
1904 1905
1896 1897
2616 2617
2608 2609
1718 1719
468 469
1271 1272
2307 2308
2662 2663
2557 255...

output:

24995000

result:

ok single line: '24995000'

Test #38:

score: 30
Accepted
time: 20ms
memory: 7440kb

input:

5000 200000
41 4109
3861 2932
4941 2178
1899 3134
1126 2726
535 3421
1347 971
3188 3943
4210 307
4207 2249
1503 1504
608 2295
1085 3707
4364 1154
1001 1888
2994 2261
675 1751
1560 1563
4860 1660
1397 1218
661 520
3338 2023
1648 1649
1788 868
873 1487
3772 317
2251 2815
1230 78
2295 4546
2316 4754
40...

output:

24995000

result:

ok single line: '24995000'

Test #39:

score: 30
Accepted
time: 0ms
memory: 6076kb

input:

5000 5000
2856 2855
3929 3930
1388 1387
4191 4192
3337 3336
1892 1893
4292 4291
2487 2486
2401 2400
2020 2021
4218 4219
1576 1577
4980 4981
3451 3450
1246 1247
2336 2335
4856 4857
2327 2326
2474 2475
1503 1504
1457 1456
422 421
2384 2385
1613 1612
2616 2617
2767 2766
3279 3280
1718 1719
3595 3594
46...

output:

13941554

result:

ok single line: '13941554'

Test #40:

score: 30
Accepted
time: 1ms
memory: 4032kb

input:

5000 5001
2856 2855
3902 3901
3929 3930
1482 1483
364 363
1304 1303
1692 1693
2487 2486
3243 3244
4218 4219
1480 1481
4584 4585
802 803
4384 4383
4856 4857
3636 3635
2614 2615
3994 3993
2639 2638
422 421
4901 4900
336 337
299 298
3029 3028
2608 2609
2495 2496
1356 1357
1579 1580
2307 2308
1782 1781
...

output:

14188988

result:

ok single line: '14188988'

Test #41:

score: 30
Accepted
time: 0ms
memory: 4292kb

input:

5000 10000
2614 2615
2511 2457
1609 1608
2073 4896
1246 1247
4064 4063
813 3284
1478 4591
591 590
1626 1625
4435 1619
299 298
4788 4789
759 760
3314 2341
770 1249
1033 3773
4550 1123
3279 2130
4932 4829
3551 4957
564 565
3293 2666
1252 1741
3342 3343
4852 4851
619 620
4625 4626
4248 2094
3309 3310
7...

output:

20799477

result:

ok single line: '20799477'

Test #42:

score: 30
Accepted
time: 2ms
memory: 6064kb

input:

5000 4999
4138 4518
42 4680
620 975
271 567
116 1050
403 3504
1840 3395
533 3901
1796 3509
420 4311
2101 4063
502 3975
1363 4387
162 450
2628 2869
1271 1840
2773 3090
2212 2490
1177 3735
4633 4821
492 1605
3674 4692
907 3717
2307 3748
15 30
871 1633
1271 3016
1401 3865
221 288
261 1177
1231 3846
217...

output:

24985012

result:

ok single line: '24985012'

Test #43:

score: 30
Accepted
time: 0ms
memory: 4292kb

input:

5000 4999
4804 701
655 86
2612 660
1595 775
1913 1361
1008 863
2808 1788
2004 1463
610 40
956 727
2646 1626
3285 2600
2900 2654
2098 903
4883 1423
994 744
1391 1192
4320 1247
1281 1127
2002 1023
147 33
4004 3009
2552 1930
739 46
4603 3419
244 141
1557 894
1422 415
3861 2971
3175 954
4044 3367
182 15...

output:

4999

result:

ok single line: '4999'

Test #44:

score: 30
Accepted
time: 1ms
memory: 4008kb

input:

5000 4999
396 1583
125 487
548 585
1231 1748
2352 1859
40 2805
2772 1015
334 77
808 810
1168 1590
2112 1024
3221 4010
176 1462
2830 3317
404 690
509 334
574 2148
2162 885
40 848
2205 2234
4002 260
2239 1706
44 34
279 414
1039 109
2898 4940
4771 4918
1477 3691
1099 1228
359 1062
4075 1500
2718 1361
4...

output:

8185439

result:

ok single line: '8185439'

Test #45:

score: 30
Accepted
time: 0ms
memory: 6112kb

input:

5000 4999
3929 3930
566 567
2235 2236
4191 4192
4768 4769
1692 1693
4421 4422
2020 2021
3307 3308
1480 1481
4712 4713
4199 4200
1246 1247
4521 4522
4856 4857
1482 1483
735 736
2066 2067
1312 1313
336 337
1904 1905
1896 1897
2616 2617
2608 2609
1718 1719
468 469
1271 1272
2307 2308
2662 2663
2557 255...

output:

4999

result:

ok single line: '4999'

Test #46:

score: 30
Accepted
time: 2ms
memory: 6100kb

input:

5000 4999
2856 2855
3902 3901
4800 4801
3530 3531
364 363
1892 1893
1609 1608
1036 1037
2020 2021
2600 2601
2074 2073
3451 3450
3566 3567
2016 2015
2327 2326
426 427
3994 3993
4831 4832
4687 4686
4042 4043
1443 1442
336 337
3797 3796
3029 3028
4958 4957
3279 3280
3236 3237
971 970
1580 1581
759 760
...

output:

14143837

result:

ok single line: '14143837'

Subtask #3:

score: 65
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #47:

score: 65
Accepted
time: 22ms
memory: 6992kb

input:

2000 200000
464 1905
1283 1474
1322 612
404 1729
1707 1994
1863 1523
1132 1407
655 776
1372 270
1637 278
457 1893
309 204
1650 730
1916 1715
755 1651
424 1198
1902 1930
987 1461
839 1708
1724 1738
878 50
1858 628
1085 1024
560 402
753 132
951 1363
1512 1667
1913 1
1320 1802
1596 1379
1345 329
1563 1...

output:

3998000

result:

ok single line: '3998000'

Test #48:

score: 65
Accepted
time: 41ms
memory: 11768kb

input:

100000 200000
2436 20861
35318 96020
94922 62565
43918 73234
39869 30858
83820 48979
10107 71917
19679 91500
3676 40596
77188 33625
7733 52549
25712 1295
12063 7481
17538 39995
45443 92236
62843 67029
62739 53456
94165 76606
11991 61903
59342 60366
84493 15294
29193 25413
46802 81657
50435 81518
866...

output:

7375488669

result:

ok single line: '7375488669'

Test #49:

score: 65
Accepted
time: 40ms
memory: 11224kb

input:

100000 200000
65388 65794
12833 51259
3211 99211
33086 2668
56346 34332
19566 24749
7194 55679
70252 81604
15054 35330
41637 13672
16182 79028
43364 56038
8879 26713
46473 80611
48600 20942
29141 73892
50353 32409
4746 68833
23688 95238
98807 41702
70565 85655
85420 25448
82968 15337
18363 55188
602...

output:

7389751496

result:

ok single line: '7389751496'

Test #50:

score: 65
Accepted
time: 16ms
memory: 10600kb

input:

95991 102003
15979 91504
79367 95694
36344 75697
95759 23491
44693 55452
76030 9185
33828 55675
53343 92911
21181 93014
36583 17968
389 19029
8253 37656
10394 14314
12816 34062
92343 60577
2241 73759
43081 46861
12955 77050
29155 22380
21235 73939
85832 72230
42897 7278
38341 80716
38440 66560
21285...

output:

3257312146

result:

ok single line: '3257312146'

Test #51:

score: 65
Accepted
time: 12ms
memory: 9504kb

input:

100000 51663
66547 75942
73991 79681
72637 21097
92707 64385
45307 47713
57582 27181
21931 36756
28999 44650
69578 69524
42098 14654
13161 53646
41372 47467
57085 62527
97954 31300
71195 2776
46329 52161
20330 46810
7116 61878
65690 37426
71617 20898
46738 10454
3573 29818
75054 1744
18624 1327
5690...

output:

13904438

result:

ok single line: '13904438'

Test #52:

score: 65
Accepted
time: 36ms
memory: 9208kb

input:

44145 200000
14862 35179
6945 30658
5220 4007
15571 4358
26390 7931
14830 23058
20321 13850
28921 14106
36496 21312
18274 217
6769 30359
39673 4707
34649 26179
33211 28978
22131 10257
41494 709
8874 12175
30755 11519
25790 35121
33067 15905
868 24089
35670 14950
25174 9003
3295 11582
31754 31400
361...

output:

1908949265

result:

ok single line: '1908949265'

Test #53:

score: 65
Accepted
time: 34ms
memory: 12040kb

input:

100000 200000
19 24
3 21
19 15
6 2
17 25
19 22
25 21
13 30
31 30
28 12
5 8
26 6
15 11
23 11
7 24
2 33
8 29
19 3
8 6
11 18
8 16
12 21
12 7
3 30
16 33
8 30
18 6
26 4
22 11
26 8
30 22
6 5
26 18
11 7
28 17
9 2
32 18
29 32
17 21
3 9
27 8
13 9
20 16
8 4
88 154
162 48
122 135
187 92
114 93
185 46
174 94
10...

output:

349595201

result:

ok single line: '349595201'

Test #54:

score: 65
Accepted
time: 30ms
memory: 11336kb

input:

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

output:

175860073

result:

ok single line: '175860073'

Test #55:

score: 65
Accepted
time: 17ms
memory: 10680kb

input:

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

output:

160695586

result:

ok single line: '160695586'

Test #56:

score: 65
Accepted
time: 16ms
memory: 10956kb

input:

94949 155114
30 26
3 20
18 4
23 41
42 20
45 9
23 7
30 13
43 42
39 45
28 35
27 45
23 21
44 20
24 39
44 39
21 40
4 16
46 32
4 35
7 25
35 46
7 35
6 41
28 17
23 28
33 4
1 38
45 41
9 7
30 45
36 29
10 42
33 45
9 4
15 36
39 41
22 45
30 46
25 19
6 32
44 5
32 16
28 27
44 16
44 35
34 26
33 2
31 11
26 33
46 36...

output:

422487612

result:

ok single line: '422487612'

Test #57:

score: 65
Accepted
time: 42ms
memory: 11948kb

input:

100000 200000
64289 71618
62488 87582
70707 9554
15712 99359
8377 58879
54149 10576
17628 54614
77072 23836
74690 83744
76080 6176
43975 20304
63157 58565
97881 19567
68547 69146
11958 85695
11091 49483
65982 81517
19332 13244
22863 11672
91531 71723
50974 70101
74663 81217
62145 17850
90765 43929
7...

output:

7388548025

result:

ok single line: '7388548025'

Test #58:

score: 65
Accepted
time: 38ms
memory: 11668kb

input:

100000 200000
82128 46859
74393 13387
41061 4997
40262 30731
6585 7123
24169 81751
54296 48633
242 64998
99540 37545
15555 27197
36114 86664
76757 44007
73286 4975
13703 54166
7327 4810
31544 2996
58325 88174
73444 42762
2988 93596
92419 80173
70112 82254
24842 56500
28080 82588
68257 42930
38103 17...

output:

7472505804

result:

ok single line: '7472505804'

Test #59:

score: 65
Accepted
time: 17ms
memory: 11792kb

input:

100000 100000
55809 88449
61965 48748
65963 5343
47464 93493
36815 79754
23715 83507
57897 15908
74975 16761
63732 4868
64770 28241
33551 67386
56037 69488
46355 94493
93295 43476
88170 40333
88466 75825
28446 75382
62993 62435
16495 30458
47751 82385
50026 151
69739 54898
92094 73362
83986 45453
96...

output:

100000

result:

ok single line: '100000'

Test #60:

score: 65
Accepted
time: 22ms
memory: 7632kb

input:

10000 200000
8202 2792
9764 3760
1640 1527
3322 1914
7558 2635
4196 2511
1018 6332
2234 5950
1902 3439
2410 6016
8517 6562
3094 8128
3083 3693
4261 6665
3576 4552
4099 3715
6666 4042
8517 7687
4169 4726
44 2982
6672 5083
3950 602
3222 2055
6632 6203
7533 7231
945 7434
5373 8667
6412 1941
9380 4586
5...

output:

99990000

result:

ok single line: '99990000'

Test #61:

score: 65
Accepted
time: 11ms
memory: 9688kb

input:

100000 50000
77177 90756
40256 59726
18883 24564
50128 26007
51787 99287
21542 7522
55825 82765
78053 59132
31906 40027
68751 73937
39333 7934
30220 96155
47091 38150
33852 66589
51858 43525
37123 57195
18688 96871
42050 12010
32048 96929
7928 82606
31967 6136
11423 30858
73807 47428
47013 72343
297...

output:

479282

result:

ok single line: '479282'

Test #62:

score: 65
Accepted
time: 0ms
memory: 8508kb

input:

100000 3000
61426 61366
99720 33927
97159 5313
82743 61793
66092 20250
4056 27771
60113 84168
59154 29823
2164 70503
50394 35498
55624 55590
86582 85596
57576 29200
92027 17270
27084 26728
78643 89432
181 87829
19371 7262
17513 13935
49486 29939
81065 26179
12085 82014
71682 47327
22568 49683
1997 2...

output:

3107

result:

ok single line: '3107'

Test #63:

score: 65
Accepted
time: 1ms
memory: 6244kb

input:

100000 0

output:

0

result:

ok single line: '0'

Test #64:

score: 65
Accepted
time: 41ms
memory: 11176kb

input:

100000 200000
42975 68412
82554 12436
95591 7265
45884 12956
22835 18894
90846 56766
45273 85013
43428 31540
38355 21195
47444 37065
98478 6187
40443 38551
3257 17168
57967 46299
23300 62629
36857 33605
78784 65496
45105 1470
65700 60141
66921 81726
91098 3481
5625 36724
6420 67173
88319 94686
82344...

output:

7407642487

result:

ok single line: '7407642487'

Test #65:

score: 65
Accepted
time: 39ms
memory: 11032kb

input:

100000 200000
19855 78328
41833 13860
72671 48304
95812 72206
60701 21579
97683 30296
43208 53224
99420 27259
1680 13029
56909 44301
989 8591
1510 92431
62962 30740
20541 61905
40450 61203
22725 46021
16188 47434
85750 63410
88385 75240
39281 18829
59636 4869
60402 66283
8747 12170
36326 77746
11677...

output:

7414529418

result:

ok single line: '7414529418'

Test #66:

score: 65
Accepted
time: 22ms
memory: 8704kb

input:

100000 100000
51948 84866
54840 57554
63940 92147
42625 79309
62048 47827
21707 24713
99740 49430
90597 71544
83706 46303
79061 43711
60307 16867
32579 20157
10243 1425
10452 83387
55801 63089
357 11403
96541 25546
9092 23960
21550 65620
90219 65721
19327 19232
46932 14299
97525 88951
62156 50383
81...

output:

3420011126

result:

ok single line: '3420011126'

Test #67:

score: 65
Accepted
time: 7ms
memory: 9716kb

input:

100000 50000
50571 54378
86253 60578
84360 2220
50335 21828
10532 38287
60659 1225
70085 92634
3683 3699
55253 46649
18076 32096
47127 46604
32264 61716
2933 82738
62979 44859
33330 39393
89540 5610
37888 79392
15734 51894
80806 95947
31823 3647
70883 78494
70688 4896
83492 21797
17384 53160
60153 5...

output:

266000571

result:

ok single line: '266000571'

Test #68:

score: 65
Accepted
time: 0ms
memory: 7836kb

input:

100000 1000
81080 94153
43907 37176
71431 84174
29797 86759
55937 34540
60064 1043
58644 46152
26257 49918
93011 65326
55204 89520
75714 58144
17362 55613
8898 10499
989 98976
27321 61442
69817 79208
16276 90001
68976 10770
19529 41741
6249 34497
95864 43548
59746 67390
98067 8100
18775 44256
21802 ...

output:

1018

result:

ok single line: '1018'

Test #69:

score: 65
Accepted
time: 13ms
memory: 6748kb

input:

5000 100000
2796 2946
1905 3496
2790 2376
2347 3464
1057 2477
1782 2938
1819 3820
1538 2333
4654 4589
2121 2551
643 1392
196 1571
3454 4190
1213 782
897 448
1295 609
4749 3232
2314 2958
2929 3746
4649 3080
1750 2426
3376 1052
4986 2815
4853 2277
873 594
867 4316
4184 2420
4250 1880
4827 1178
2421 50...

output:

24995000

result:

ok single line: '24995000'

Test #70:

score: 65
Accepted
time: 21ms
memory: 10108kb

input:

88778 114000
12628 7949
44053 27354
15803 27598
66974 70659
11733 9282
64819 55067
4996 68048
42457 58208
83986 36422
33852 39022
9986 26658
15695 44883
9566 23833
40910 22470
15246 62193
76031 67613
35056 18789
84927 20850
68300 25639
82819 83405
78597 40888
53056 65132
13882 55287
57622 41810
5662...

output:

3858245625

result:

ok single line: '3858245625'

Test #71:

score: 65
Accepted
time: 14ms
memory: 12084kb

input:

100000 100000
87468 87469
35453 35454
96447 96448
97995 97996
862 863
38440 38441
16914 16915
6960 6961
93794 93795
21039 21040
1503 1504
20094 20095
63506 63507
86352 86353
61592 61593
57508 57509
8660 8661
74487 74488
47954 47955
15129 15130
26780 26781
34500 34501
58411 58412
21923 21924
51584 51...

output:

100000

result:

ok single line: '100000'

Test #72:

score: 65
Accepted
time: 21ms
memory: 11916kb

input:

100000 100001
87468 87469
35453 35454
96447 96448
97995 97996
862 863
38440 38441
16914 16915
6960 6961
93794 93795
21039 21040
1503 1504
20094 20095
63506 63507
86352 86353
61592 61593
57508 57509
8660 8661
74487 74488
47954 47955
15129 15130
26780 26781
34500 34501
58411 58412
21923 21924
51584 51...

output:

9999900000

result:

ok single line: '9999900000'

Test #73:

score: 65
Accepted
time: 36ms
memory: 12052kb

input:

100000 200000
38130 38131
35453 35454
80807 32377
38440 38441
81871 23659
16914 16915
1503 1504
47511 86950
97334 97335
44704 44705
42646 42647
52493 52494
35370 35371
21172 21173
22571 22572
65415 85113
74521 74522
71933 10327
65340 62593
96156 93818
12087 63270
84858 71622
21923 21924
39659 39660
...

output:

9999900000

result:

ok single line: '9999900000'

Test #74:

score: 65
Accepted
time: 16ms
memory: 10872kb

input:

100000 100000
83208 83207
17705 17704
87468 87469
35453 35454
14775 14774
68040 68041
16914 16915
6960 6961
43296 43295
1503 1504
16975 16974
422 421
85664 85665
2637 2636
2767 2766
8660 8661
73395 73396
74107 74106
41753 41754
26780 26781
34500 34501
85126 85125
58411 58412
83529 83528
51584 51585
...

output:

5612532138

result:

ok single line: '5612532138'

Test #75:

score: 65
Accepted
time: 11ms
memory: 9388kb

input:

100000 100001
17672 17671
87468 87469
30636 30635
17668 17667
80311 80310
97995 97996
38440 38441
9438 9439
43296 43295
26079 26080
26033 26032
422 421
44704 44705
14925 14924
44364 44365
56055 56056
41753 41754
43364 43365
33658 33657
50966 50965
21923 21924
50761 50760
80256 80257
3267 3266
21295 ...

output:

5613431161

result:

ok single line: '5613431161'

Test #76:

score: 65
Accepted
time: 37ms
memory: 12132kb

input:

100000 200000
38130 38131
35362 12188
35453 35454
89118 94804
14775 14774
17914 75094
83468 83467
34416 98270
92616 92617
62182 71330
9438 9439
26079 26080
9818 9817
44704 44705
17843 17842
26291 26292
51278 39705
41794 95265
74521 74522
57290 57289
55377 22084
67505 31641
59625 19891
21923 21924
41...

output:

8245302998

result:

ok single line: '8245302998'

Test #77:

score: 65
Accepted
time: 20ms
memory: 8796kb

input:

100000 99999
45348 93626
54670 98193
25498 41814
8055 10721
55306 60146
7619 14179
12681 61520
8193 14537
31238 69101
21262 46078
69904 77246
25988 27756
10465 32384
46229 94791
696 8626
5969 11122
49727 51947
1955 6754
3595 3688
7906 37854
38200 61512
7301 36058
44272 48887
27593 72338
50549 89434
...

output:

9999700016

result:

ok single line: '9999700016'

Test #78:

score: 65
Accepted
time: 15ms
memory: 9996kb

input:

100000 99999
83077 47300
50857 13763
20825 10565
63262 833
95384 75608
24655 15594
90 42
76078 69379
25077 20492
37388 34812
52213 36077
43511 8997
61176 36398
45452 21479
51690 38854
17799 4318
92030 71510
18201 5914
78087 38463
69188 2776
53513 23621
82211 30810
46365 7803
80946 78624
19158 11709
...

output:

99999

result:

ok single line: '99999'

Test #79:

score: 65
Accepted
time: 16ms
memory: 10128kb

input:

100000 100000
36499 12991
79954 26275
52618 1834
56735 23955
83639 6184
41795 1704
83957 30057
60213 35978
35101 21711
93905 23568
50468 29611
43352 413
31119 20921
97353 9986
3595 802
99208 35807
18714 14500
23305 9215
67367 28412
7660 1335
68283 49827
47552 27595
92214 20983
3830 2907
81312 33650
...

output:

100324

result:

ok single line: '100324'

Test #80:

score: 65
Accepted
time: 17ms
memory: 9424kb

input:

100000 99999
77063 23733
9359 13495
5160 25195
45029 95303
23249 15934
87614 58344
98172 70060
40896 8738
67655 53954
4137 55021
69478 60818
88191 12722
3324 13149
56590 72466
2698 33548
27769 9804
5484 3346
4691 26669
55723 44312
24309 24113
31958 3018
20668 15379
27356 61586
78802 21731
6595 25542...

output:

3213305912

result:

ok single line: '3213305912'

Test #81:

score: 65
Accepted
time: 17ms
memory: 11432kb

input:

100000 99999
87468 87469
35453 35454
96447 96448
97995 97996
862 863
38440 38441
16914 16915
6960 6961
93794 93795
21039 21040
1503 1504
20094 20095
63506 63507
86352 86353
61592 61593
57508 57509
8660 8661
74487 74488
47954 47955
15129 15130
26780 26781
34500 34501
58411 58412
21923 21924
51584 515...

output:

99999

result:

ok single line: '99999'

Test #82:

score: 65
Accepted
time: 13ms
memory: 12180kb

input:

100000 100000
87468 87469
35453 35454
96447 96448
97995 97996
862 863
38440 38441
16914 16915
6960 6961
93794 93795
21039 21040
1503 1504
20094 20095
63506 63507
86352 86353
61592 61593
57508 57509
8660 8661
74487 74488
47954 47955
15129 15130
26780 26781
34500 34501
58411 58412
21923 21924
51584 51...

output:

4461805615

result:

ok single line: '4461805615'

Test #83:

score: 65
Accepted
time: 20ms
memory: 11108kb

input:

100000 99999
88579 88578
17672 17671
89673 89672
11975 11974
85548 85547
38440 38441
16914 16915
1503 1504
16975 16974
72102 72101
86352 86353
2637 2636
21172 21173
26291 26292
34940 34941
19581 19582
97414 97413
29819 29818
21923 21924
24137 24136
1648 1649
4925 4924
21295 21296
18213 18214
24162 2...

output:

5632477349

result:

ok single line: '5632477349'

Extra Test:

score: 0
Extra Test Passed