QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#111935#4742. PrawnicyMaMengQi100 ✓566ms72192kbC++201.6kb2023-06-09 10:36:072023-06-09 10:36:11

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 20
Accepted

Test #1:

score: 20
Accepted
time: 2ms
memory: 3376kb

input:

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

output:

4
4 1 2 

result:

ok good answer on both questions!

Test #2:

score: 20
Accepted
time: 2ms
memory: 3436kb

input:

13 7
30 65
3 20
24 55
9 30
6 25
39 80
33 70
36 75
15 40
12 35
18 45
21 50
27 60

output:

11
12 3 13 1 7 8 6 

result:

ok good answer on both questions!

Test #3:

score: 20
Accepted
time: 2ms
memory: 3324kb

input:

7 2
2 5
2 5
4 7
4 7
5 8
5 8
3 5

output:

3
1 2 

result:

ok good answer on both questions!

Test #4:

score: 20
Accepted
time: 2ms
memory: 3388kb

input:

9 3
16 32
21 36
68 80
66 80
27 46
15 32
32 43
64 80
23 41

output:

12
8 4 3 

result:

ok good answer on both questions!

Test #5:

score: 20
Accepted
time: 2ms
memory: 3388kb

input:

17 7
2 27
1 50
171 220
190 228
208 220
1 38
188 227
192 221
212 239
54 83
30 74
1 44
3 28
1 39
191 221
3 29
287 320

output:

24
6 14 12 2 1 13 16 

result:

ok good answer on both questions!

Test #6:

score: 20
Accepted
time: 2ms
memory: 3388kb

input:

20 4
420 488
209 280
335 424
328 413
279 363
246 314
289 349
269 350
296 391
365 441
347 444
198 270
179 276
286 362
368 439
315 361
359 415
274 348
380 425
399 490

output:

62
8 18 5 14 

result:

ok good answer on both questions!

Test #7:

score: 20
Accepted
time: 2ms
memory: 3388kb

input:

19 5
290 295
77 125
168 201
230 235
282 330
138 153
73 76
356 374
263 273
201 222
180 195
291 332
108 111
90 107
280 327
290 337
289 333
334 359
41 46

output:

36
15 5 17 16 12 

result:

ok good answer on both questions!

Test #8:

score: 20
Accepted
time: 2ms
memory: 3332kb

input:

20 10
248 260
72 87
356 372
69 88
82 103
404 414
68 87
50 71
68 89
77 97
131 142
77 96
74 87
25 37
402 416
81 87
130 144
201 211
78 91
70 89

output:

6
7 9 4 20 2 13 12 10 19 16 

result:

ok good answer on both questions!

Test #9:

score: 20
Accepted
time: 0ms
memory: 3444kb

input:

20 4
385 426
12 37
386 419
240 275
2 43
234 274
232 278
169 205
225 269
379 395
381 402
232 280
164 209
5 39
218 263
157 205
219 265
385 398
233 275
171 207

output:

40
7 12 19 6 

result:

ok good answer on both questions!

Test #10:

score: 20
Accepted
time: 2ms
memory: 3432kb

input:

20 5
1 4
1 3
2 4
1 4
1 3
1 3
1 3
2 3
2 3
2 3
1 3
1 3
1 3
2 4
2 4
2 3
2 4
2 4
1 3
2 4

output:

2
2 5 6 7 11 

result:

ok good answer on both questions!

Test #11:

score: 20
Accepted
time: 2ms
memory: 3336kb

input:

20 5
1 2
1 4
1 2
3 4
1 4
2 4
2 4
1 3
1 2
3 4
2 3
2 4
2 4
3 4
2 3
1 4
1 3
3 4
1 2
2 4

output:

2
8 17 2 5 16 

result:

ok good answer on both questions!

Test #12:

score: 20
Accepted
time: 2ms
memory: 3388kb

input:

7 3
34 43
2 11
26 40
25 31
28 40
4 11
5 9

output:

6
3 5 1 

result:

ok good answer on both questions!

Test #13:

score: 20
Accepted
time: 2ms
memory: 3424kb

input:

17 12
15004623 108198380
6001923 43279283
16004923 115411613
13004023 93771914
12003723 86558681
5001623 36066050
2000723 14426351
14004323 100985147
9002823 64918982
8002523 57705749
7002223 50492516
17005223 122624846
3001023 21639584
1000423 7213118
4001323 28852817
10003123 72132215
11003423 793...

output:

26274060
2 11 10 9 16 17 5 4 8 1 3 12 

result:

ok good answer on both questions!

Test #14:

score: 20
Accepted
time: 1ms
memory: 3328kb

input:

13 3
144503784 144503877
396967175 396967284
144503792 144503895
97541682 97541769
97541695 97541773
396967215 396967290
144503794 144503897
396967206 396967299
341685161 341685238
183786823 183786855
144503824 144503871
97541651 97541754
144503822 144503909

output:

83
1 3 7 

result:

ok good answer on both questions!

Test #15:

score: 20
Accepted
time: 2ms
memory: 3324kb

input:

11 5
148518837 148519034
218763545 218763716
218763460 218763629
148518746 148518953
148518748 148518937
157058642 157058644
148518806 148518951
148518805 148518967
218763374 218763583
218763537 218763661
218763510 218763684

output:

100
4 5 8 7 1 

result:

ok good answer on both questions!

Test #16:

score: 20
Accepted
time: 2ms
memory: 3332kb

input:

16 2
358241830 363111811
727033309 731013915
411688284 416477252
411666324 416485126
147619720 152282502
411545550 416440647
726262823 730896523
726510268 730157192
414570702 417226273
448013367 450785589
445112827 450108967
358906711 362152369
359080349 363970270
728291140 732766025
148622237 15258...

output:

4788968
4 3 

result:

ok good answer on both questions!

Test #17:

score: 20
Accepted
time: 2ms
memory: 3412kb

input:

20 5
114686836 630742792
680381266 918567885
306589686 877764658
45777970 953967857
206159325 380008169
82422754 388987434
508562180 934623235
449225963 740196668
54887384 802558239
30279672 991075652
37271901 945918881
705212488 999411310
748738003 892622799
81640248 491079951
554413663 893332591
4...

output:

601141796
10 11 4 18 19 

result:

ok good answer on both questions!

Test #18:

score: 20
Accepted
time: 0ms
memory: 3352kb

input:

17 5
330190158 332327308
993204118 997033392
253661688 256762727
990448750 994614033
591337231 595937865
991144392 995946497
362313651 363170096
819112158 821085949
774729685 775633155
367063850 371805650
672197048 677166123
477905527 478001653
124430569 126788050
458656856 462332175
379822338 38328...

output:

579094
16 4 6 2 17 

result:

ok good answer on both questions!

Test #19:

score: 20
Accepted
time: 2ms
memory: 3332kb

input:

20 10
3021122 62914915
9590555 82439856
11486930 86614270
28193580 96472669
124877 64584820
6972012 69667799
10712521 85858677
2866497 77182935
22760881 95458927
24162165 92439450
5248844 97449091
6310210 91726917
8424445 51635398
22359403 35198737
5348823 71734495
16724837 97883357
5876881 86565561...

output:

58277691
11 17 12 2 7 3 20 16 9 10 

result:

ok good answer on both questions!

Test #20:

score: 20
Accepted
time: 2ms
memory: 3332kb

input:

20 7
7727671 180735109
7827116 267861675
11019977 309692538
53849518 242335995
32248046 327525848
30777756 81715214
60015335 254276432
207027568 208648532
49746698 254928154
20174222 246105304
823377 304696090
65030900 84815715
55625651 223334544
87892472 281710386
542630245 556510000
5179186 164984...

output:

194261097
11 2 3 5 9 18 7 

result:

ok good answer on both questions!

Test #21:

score: 20
Accepted
time: 2ms
memory: 3336kb

input:

20 5
3 999999998
3 999999999
3 1000000000
2 1000000000
2 999999999
1 999999999
3 999999998
1 999999999
3 999999998
3 999999999
1 999999999
1 999999998
3 1000000000
1 999999998
2 999999998
3 999999999
1 1000000000
1 999999998
1 999999998
1 999999999

output:

999999998
6 8 11 20 17 

result:

ok good answer on both questions!

Test #22:

score: 20
Accepted
time: 2ms
memory: 3372kb

input:

20 5
3 4
1 5
3 7
4 6
4 5
1 6
2 7
2 5
2 6
5 7
2 7
1 3
1 7
2 3
5 6
5 7
2 5
5 6
2 3
2 4

output:

4
6 13 9 7 11 

result:

ok good answer on both questions!

Subtask #2:

score: 15
Accepted

Test #23:

score: 15
Accepted
time: 2ms
memory: 3436kb

input:

217 21
13 175
13 276
13 297
13 138
13 184
13 265
13 203
13 176
13 110
13 282
13 267
13 218
13 84
13 135
13 195
13 225
13 129
13 124
13 148
13 219
13 162
13 142
13 180
13 94
13 153
13 149
13 254
13 125
13 168
13 83
13 299
13 200
13 103
13 247
13 164
13 143
13 259
13 288
13 214
13 88
13 272
13 102
13 ...

output:

266
185 157 87 10 107 182 65 76 164 38 188 64 140 147 203 134 160 101 3 116 31 

result:

ok good answer on both questions!

Test #24:

score: 15
Accepted
time: 0ms
memory: 3444kb

input:

233 33
255 291
19 104
199 294
207 284
108 216
38 148
260 289
23 107
48 156
4 92
12 88
108 184
201 297
15 114
112 209
69 171
224 299
12 66
191 299
83 190
211 298
20 99
261 298
189 284
204 295
3 111
206 295
154 204
78 132
3 71
10 61
212 300
18 41
19 119
193 299
119 210
239 296
53 113
43 122
23 113
207...

output:

74
50 231 222 26 185 106 86 186 172 81 221 156 198 110 189 102 141 66 14 68 65 76 127 2 34 22 98 113 130 224 159 8 40 

result:

ok good answer on both questions!

Test #25:

score: 15
Accepted
time: 2ms
memory: 3444kb

input:

150 17
5 65
116 215
12 109
8 106
1 77
87 180
9 67
6 77
88 162
2 94
27 100
1 82
115 178
14 108
86 183
81 152
45 143
19 108
5 41
8 42
82 179
11 83
1 77
6 70
12 100
20 115
7 105
3 85
8 107
3 72
4 84
17 75
78 156
92 153
70 108
124 211
4 100
76 167
41 117
6 80
37 114
1 38
2 78
81 180
7 77
66 158
5 71
57 ...

output:

82
113 44 89 21 68 124 138 50 15 6 74 78 141 86 146 109 49 

result:

ok good answer on both questions!

Test #26:

score: 15
Accepted
time: 2ms
memory: 3408kb

input:

300 100
190 293
142 281
183 286
107 140
88 284
176 181
68 192
109 295
204 234
177 299
18 88
19 265
89 291
91 269
2 25
119 168
47 246
96 271
62 258
76 101
57 188
17 207
43 275
165 241
19 294
127 236
206 285
31 288
5 131
172 277
132 283
16 228
172 298
93 260
51 289
99 300
42 182
44 238
146 254
112 265...

output:

159
262 42 98 287 269 176 244 231 212 166 148 125 237 247 298 162 97 206 143 78 82 228 94 211 121 62 271 12 108 25 120 266 202 58 48 257 174 196 217 234 28 49 138 141 157 177 190 260 126 77 252 100 23 38 170 118 103 281 136 128 115 17 282 60 116 75 259 54 46 218 35 255 295 65 240 55 283 132 84 158 2...

result:

ok good answer on both questions!

Test #27:

score: 15
Accepted
time: 2ms
memory: 3396kb

input:

300 55
104 204
78 249
42 271
29 277
52 259
16 264
35 274
27 249
82 246
79 239
3 269
69 256
22 209
22 239
41 254
67 282
24 281
27 216
47 256
40 271
220 278
48 227
15 249
65 287
49 234
16 197
53 242
95 272
107 284
1 300
59 253
74 232
8 296
46 221
79 300
5 203
31 192
22 151
61 267
10 279
30 246
34 295
...

output:

223
30 153 64 11 228 294 148 178 33 300 43 59 40 69 84 272 93 221 145 6 101 249 292 156 180 257 17 245 107 85 164 168 109 125 87 4 183 243 106 147 291 134 143 297 114 42 165 7 247 136 250 61 45 271 208 

result:

ok good answer on both questions!

Test #28:

score: 15
Accepted
time: 2ms
memory: 3452kb

input:

275 79
55 264
34 55
14 178
72 226
90 291
85 186
1 296
105 272
46 274
13 20
4 295
101 214
64 265
5 230
4 300
72 195
36 281
88 233
29 115
241 249
43 165
41 210
47 296
15 23
23 129
89 188
145 278
119 196
7 234
34 150
40 189
52 108
40 295
25 207
46 218
91 198
55 134
130 157
28 199
72 275
159 213
18 164
...

output:

174
7 189 264 270 234 247 207 11 15 191 75 225 261 82 64 263 168 196 176 72 185 123 195 212 49 161 73 124 113 266 106 254 249 43 226 58 250 52 108 174 220 57 164 17 96 133 63 92 77 71 33 148 170 97 79 51 9 227 190 23 271 122 128 142 1 245 145 162 65 268 121 135 111 204 13 213 186 85 231 

result:

ok good answer on both questions!

Test #29:

score: 15
Accepted
time: 1ms
memory: 3396kb

input:

300 17
104 215
19 299
45 268
14 161
35 90
32 227
35 274
69 299
51 247
141 199
13 218
138 271
7 290
79 290
61 270
22 266
25 237
239 252
48 106
20 280
8 276
230 233
159 261
115 243
76 291
43 184
18 259
100 282
75 233
48 103
203 240
2 124
38 248
54 86
12 232
24 290
53 205
1 299
71 109
25 240
50 183
106...

output:

278
139 191 38 125 152 255 177 108 275 274 285 92 85 13 198 220 45 

result:

ok good answer on both questions!

Test #30:

score: 15
Accepted
time: 2ms
memory: 3344kb

input:

300 37
141 246
8 61
127 257
94 209
190 288
51 125
149 260
64 181
141 269
114 238
175 239
183 267
174 277
134 256
148 262
62 183
110 235
148 270
140 252
154 262
189 299
151 282
192 274
54 186
111 235
124 243
6 133
168 275
174 251
154 263
199 275
96 220
125 255
164 287
138 268
137 263
127 254
131 263
...

output:

120
56 58 200 111 135 105 217 175 221 204 33 236 174 116 171 37 3 147 92 253 271 275 248 172 96 38 139 180 51 259 76 101 258 269 14 86 160 

result:

ok good answer on both questions!

Test #31:

score: 15
Accepted
time: 2ms
memory: 3444kb

input:

300 30
1 300
3 296
1 297
5 297
5 300
4 300
5 299
1 296
1 299
4 299
5 299
3 300
1 299
3 298
3 298
5 298
2 296
4 300
5 297
5 298
3 299
5 296
5 298
4 298
2 300
2 300
5 297
1 299
1 298
4 297
5 297
2 300
5 300
1 296
4 299
5 300
4 299
4 296
4 296
5 298
4 298
5 298
2 300
2 298
5 299
5 298
2 300
4 297
4 299...

output:

297
29 56 107 116 131 149 167 181 186 223 228 258 9 13 28 83 97 99 122 162 177 178 239 287 1 61 67 142 148 154 

result:

ok good answer on both questions!

Test #32:

score: 15
Accepted
time: 1ms
memory: 3396kb

input:

300 30
7 9
4 7
5 8
4 5
2 3
2 8
7 8
1 9
1 5
5 8
3 5
7 8
2 7
6 9
1 9
6 8
1 5
2 7
1 8
6 7
3 5
4 5
4 7
2 4
7 8
1 9
3 5
2 3
5 6
1 8
4 9
3 9
5 8
3 7
5 9
6 9
3 4
4 9
1 4
2 8
3 4
6 9
3 7
1 6
4 8
3 6
5 9
2 6
6 7
6 8
4 9
2 4
1 8
4 9
6 8
2 6
3 4
2 7
2 9
2 8
2 4
2 9
1 3
1 9
3 9
3 8
7 9
2 6
6 8
2 9
1 8
4 7
2 4
2...

output:

6
121 140 153 157 165 202 249 282 19 30 53 71 122 127 132 135 160 221 260 8 15 26 64 114 126 185 226 231 265 269 

result:

ok good answer on both questions!

Subtask #3:

score: 15
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #33:

score: 15
Accepted
time: 2ms
memory: 3464kb

input:

1000 1000
1 1000001
2 1000002
3 1000003
4 1000004
5 1000005
6 1000006
7 1000007
8 1000008
9 1000009
10 1000010
11 1000011
12 1000012
13 1000013
14 1000014
15 1000015
16 1000016
17 1000017
18 1000018
19 1000019
20 1000020
21 1000021
22 1000022
23 1000023
24 1000024
25 1000025
26 1000026
27 1000027
28...

output:

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

result:

ok good answer on both questions!

Test #34:

score: 15
Accepted
time: 2ms
memory: 3396kb

input:

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

output:

1
1 

result:

ok good answer on both questions!

Test #35:

score: 15
Accepted
time: 0ms
memory: 3472kb

input:

1300 157
15899 1503861
2626 247010
6994 660626
13611 1287205
4654 439046
14365 1358603
12792 1209652
11726 1108710
16068 1519864
5785 546143
5044 475976
4069 383651
16237 1535867
15405 1457083
9217 871127
4355 410733
13104 1239196
14066 1330290
91 6965
12038 1138254
65 4503
5746 542450
15223 1439849...

output:

1390930
443 48 762 141 437 573 212 164 1251 761 199 1197 1248 1147 1015 906 648 1068 528 85 686 1182 1074 599 329 1191 23 425 532 852 183 1244 380 542 344 1279 1105 384 640 526 14 367 337 1014 956 916 250 1099 170 664 1133 328 177 1006 1227 895 816 522 94 484 495 123 510 549 721 1169 1294 525 831 73...

result:

ok good answer on both questions!

Test #36:

score: 15
Accepted
time: 2ms
memory: 3412kb

input:

700 114
835897537 835897752
355071221 355071683
355070926 355071403
355070892 355071390
355071125 355071513
835897215 835897710
193948279 193948752
355071031 355071438
835897267 835897753
193948660 193948880
355071057 355071534
835897572 835897770
168419313 168419596
673054511 673054844
835897432 83...

output:

234
183 356 459 662 284 463 251 286 339 140 69 34 610 108 146 381 550 519 241 607 548 110 638 191 147 254 402 245 637 625 563 418 95 544 169 151 369 614 325 200 447 395 499 58 301 6 445 365 229 201 657 107 26 666 602 71 291 122 401 9 520 114 489 224 157 377 319 303 608 208 655 482 617 509 225 581 49...

result:

ok good answer on both questions!

Test #37:

score: 15
Accepted
time: 2ms
memory: 3344kb

input:

1000 29
4694 5101
2683 3153
4770 5117
8399 8887
4695 5193
2827 3187
3806 4247
8026 8406
8418 8869
8163 8652
7924 8405
8188 8380
2388 2731
2578 2993
417 855
2471 2843
8029 8528
8147 8545
2318 2746
3918 4287
8333 8690
742 1022
8103 8534
5448 5923
2872 3116
7929 8426
3841 4136
2682 3013
5386 5851
8503 ...

output:

423
614 889 387 915 877 697 630 188 645 853 133 993 329 406 526 246 99 768 505 535 524 240 561 343 490 623 780 532 489 

result:

ok good answer on both questions!

Test #38:

score: 15
Accepted
time: 1ms
memory: 3364kb

input:

2500 9
282593653 924437722
857603730 997317593
208802797 685533190
2174553 972225654
950580111 981002838
322657806 864659266
711750990 961959599
209909734 836627399
215397615 253080318
172671886 880984552
728300146 878816190
89062310 290524351
26716852 972581368
764763703 860696582
104780659 4161269...

output:

972338656
1749 1214 1699 295 1098 715 929 1339 1137 

result:

ok good answer on both questions!

Test #39:

score: 15
Accepted
time: 1ms
memory: 3428kb

input:

5000 483
31386476 910488281
828269546 998372965
466864615 867859317
636073968 847617386
191489185 949607099
336956395 987815863
346316747 800775752
445426977 907277960
80214793 452983521
442904456 803910049
133889117 535891414
377220513 803053714
25994374 938706158
209353614 720510818
2729742 880965...

output:

720572167
4599 1268 1000 269 4460 15 3879 2810 3866 4849 2204 3551 2657 2324 3660 1132 3156 4113 4847 830 1149 3805 2642 1616 3810 1630 3247 228 4707 2168 1392 3151 2651 42 168 2846 2676 2570 4943 3552 3582 3340 4606 1798 1174 2927 2939 1422 3548 4070 1173 4395 1507 2684 224 4491 3807 1214 2080 1184...

result:

ok good answer on both questions!

Test #40:

score: 15
Accepted
time: 1ms
memory: 3444kb

input:

3750 211
416384612 492001512
677590240 716742507
825009475 884474276
284882586 361293526
86683964 161239596
77661914 128052996
244628130 315524106
614816932 636987809
2782232 58806077
946872405 976441968
886830914 944806154
141744653 196074621
862361010 908528596
525108045 531176509
780854022 836101...

output:

28886422
3232 1938 3516 2115 3571 2165 359 1354 2123 1558 1999 2863 1374 3521 125 2117 2065 2508 2756 3403 3370 3021 592 2262 3049 468 611 1604 598 2662 1476 3454 2131 75 970 1543 3498 3456 2098 2626 3598 2455 2372 1200 2990 3076 2674 3125 562 3070 2536 1012 3114 2974 895 3131 2204 1430 3331 1972 29...

result:

ok good answer on both questions!

Test #41:

score: 15
Accepted
time: 4ms
memory: 3440kb

input:

5000 1337
34887156 285813158
28452935 457962064
55342418 961519455
811831629 835499917
251685671 271050456
19638132 584747433
515755185 773415054
331949853 549584244
5639848 946285356
14077312 893665062
172154165 285406091
78064947 626665924
55424006 880951408
35601968 799067022
120814964 784424240
...

output:

565202672
2695 596 158 246 164 1202 235 3703 120 1791 4730 4460 3096 1015 1984 4032 4546 2535 1713 4353 3514 1641 671 637 38 2364 1682 2382 3126 1217 1520 2412 146 271 4396 2180 2010 3862 634 2896 1648 1895 4419 3371 1354 84 812 3112 3871 4263 1195 1732 3086 1774 2885 4004 3557 1516 107 2227 2035 15...

result:

ok good answer on both questions!

Test #42:

score: 15
Accepted
time: 3ms
memory: 3400kb

input:

5000 222
352702840 991584488
197689044 693189134
375132713 901349973
280262 817430643
74321078 854762299
563505577 999838087
71805422 794349699
76708115 506895952
41712272 867814310
138804522 501283579
226715484 910308051
53681515 873229879
14792334 785468231
479970096 860572841
137180290 803641860
...

output:

843556448
3246 3437 4462 3334 1041 1714 4425 2205 4211 4821 1610 2083 4952 2812 2704 1958 2166 3374 3088 1024 4065 3664 3018 1843 3329 1409 1989 1393 2315 3609 1501 2050 1382 2997 3999 3232 4304 2360 1597 2214 87 2376 285 3814 3014 390 4519 1746 3406 198 1540 4659 972 2858 1100 48 739 2857 4134 3717...

result:

ok good answer on both questions!

Test #43:

score: 15
Accepted
time: 1ms
memory: 3412kb

input:

5000 200
999999966 999999974
999999962 999999973
999999959 999999968
999999966 999999973
999999950 999999962
999999960 999999964
999999951 999999962
999999961 999999977
999999963 999999966
999999962 999999978
999999964 999999976
999999955 999999975
999999961 999999963
999999967 999999980
999999962 9...

output:

24
366 467 687 1242 1676 1805 1948 2467 3021 3292 3623 4000 4162 4746 4785 1157 1221 1508 1758 1786 1974 2436 2667 3307 3311 3595 3777 4287 4544 4956 1517 2339 2927 3304 4113 4145 4910 216 1121 1276 1868 2112 2813 2937 3224 3476 3528 4077 4214 4443 4687 35 253 326 431 441 713 937 978 2472 3112 3321 ...

result:

ok good answer on both questions!

Subtask #4:

score: 15
Accepted

Test #44:

score: 15
Accepted
time: 209ms
memory: 35244kb

input:

513231 513231
1845228 79920475
526638 33895405
10039260 365931211
798021 43367964
5129649 194562408
6360795 237535266
10147872 369722287
1617903 71985750
7231833 267938640
6865992 255169047
4929918 187590845
10395504 378365823
10324692 375894147
3728655 145661046
6194811 231741634
9493638 346886405
...

output:

4736113
376258 8701 483223 443128 182068 191453 478078 65491 258445 465122 492857 501391 16412 460401 166934 440734 171213 99066 115791 512073 335878 490707 124546 423753 263414 378943 309552 492423 409739 302841 338529 352077 25815 353778 11001 215303 331463 173232 115453 4803 400251 135063 491255 ...

result:

ok good answer on both questions!

Test #45:

score: 15
Accepted
time: 9ms
memory: 4152kb

input:

13791 13791
167418903 373657222
52048032 191327513
6331741 330762899
116563087 321305848
102476475 273083273
9299823 387224202
51089359 436094893
29884621 355433930
105143380 359042649
127051892 446961791
36401540 373573195
115887809 403138793
165035288 318027181
54876521 185328890
126341414 2640071...

output:

2181121
13020 6604 8614 4720 2584 9886 2913 4883 9649 4894 2037 816 9146 8656 2712 11784 9838 13268 7615 6197 8204 3647 11312 1264 972 9345 10653 9127 11543 661 986 3228 1423 10026 6849 11552 4921 3271 9199 11520 5712 11021 9909 1592 12944 887 11355 10106 3610 13407 9755 13526 6895 3506 12448 425 67...

result:

ok good answer on both questions!

Test #46:

score: 15
Accepted
time: 39ms
memory: 4812kb

input:

150000 1
242105518 997697478
658741563 805161992
538251435 961003551
54777195 812177543
13094229 251024550
57002628 627660759
12321720 181965234
387867813 572185571
157118438 910874185
689123860 953953173
108295848 766161397
562860074 726420280
16734194 412960155
23251215 583346897
201865001 9902560...

output:

999708206
67878 

result:

ok good answer on both questions!

Test #47:

score: 15
Accepted
time: 132ms
memory: 8780kb

input:

500000 1
134999230 849402314
15307226 279930080
487753945 965046504
97458337 910690726
71955622 853038688
16122322 815368402
82157014 882842036
21741626 962448986
65183069 497463275
353672426 860539808
196933280 698518045
102171878 945907296
5083547 435283632
572599816 964689987
936292424 978362470
...

output:

999893698
477938 

result:

ok good answer on both questions!

Test #48:

score: 15
Accepted
time: 373ms
memory: 65916kb

input:

1000000 1000000
248953718 918549649
195682056 885467354
51984847 884122973
186971444 625947472
265799586 822142957
80285385 762039010
191786040 607232421
273532507 850746862
21323730 427569245
240680175 387035647
111028343 865483198
134099377 567314554
66865814 581801913
272867396 860075347
99056087...

output:

95276463
767738 298053 967955 813202 198723 772611 71921 319610 414054 302871 508004 563618 267427 101900 945968 78693 113986 23092 291857 148902 822969 611859 763754 425431 745574 488031 838992 469039 187833 185461 231216 464567 81030 153578 439317 536155 842522 408694 483032 535895 581463 260131 5...

result:

ok good answer on both questions!

Test #49:

score: 15
Accepted
time: 57ms
memory: 5864kb

input:

250000 1
427770817 575904767
327475950 852068280
46003319 496731531
206616673 757067068
318078466 575566496
14823623 296337759
277480617 944620367
324153846 963062233
17894235 674823034
18472760 570306983
413568656 921672188
259282601 394887898
702373870 771886518
450966864 815304606
98205354 927650...

output:

999999173
160262 

result:

ok good answer on both questions!

Test #50:

score: 15
Accepted
time: 381ms
memory: 65848kb

input:

1000000 1000000
225406133 304125155
198335179 281492011
143067090 242050456
201886721 299119759
154702822 244635984
171759633 260780373
148706306 241667757
156738548 246572223
149477867 243634076
188042836 266917057
167928440 257397131
203184194 241778717
219735651 293159301
193480455 244168487
1688...

output:

11130481
947123 118073 611354 456458 536930 49673 727999 217585 724810 235853 786818 13008 270286 222735 606653 802319 941867 279545 386238 27906 609352 845077 28741 707990 962410 489011 481900 867243 124567 323151 90900 737402 995603 79188 347263 791151 606142 287110 111083 858716 937664 768101 230...

result:

ok good answer on both questions!

Test #51:

score: 15
Accepted
time: 290ms
memory: 51212kb

input:

750000 750000
230316263 404055598
124518238 324824293
11552180 253271548
156997841 359749572
63714796 324937253
72974815 400808299
55266565 340797265
79613535 302607758
6809713 256603462
77905042 361939569
104716095 232067250
34548536 274459207
152795279 471017874
112473207 430330021
113025404 24238...

output:

573356
459464 476390 90729 749643 557866 351651 676245 90935 625118 422424 515144 623882 702883 225969 503996 71558 14075 504732 202870 99874 21723 420399 222875 215413 135023 710472 511617 313615 375528 420628 169228 506517 317236 60493 469930 296709 622255 169165 440904 278530 346902 558841 533928...

result:

ok good answer on both questions!

Test #52:

score: 15
Accepted
time: 279ms
memory: 72192kb

input:

1000000 1000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 100000000...

output:

999999999
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 10...

result:

ok good answer on both questions!

Subtask #5:

score: 35
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #53:

score: 35
Accepted
time: 40ms
memory: 5492kb

input:

100000 22214
8598980 12010600
313086406 437314184
33948077 47417848
122211418 170702792
23201126 32406664
65262414 91157256
278221482 388615368
1117046 1559944
85007993 118737592
24406866 34090824
90160945 125935160
56358976 78721064
209389593 292471992
130426315 182177240
238746189 333476856
255268...

output:

27452973
16936 9933 81812 62771 61750 26859 27768 34258 95716 17317 93909 42692 86640 9830 77138 7590 59753 42046 41978 42101 194 16927 48614 13765 15453 14840 7134 55387 14350 28875 41368 80194 48182 82190 53294 91309 25495 25491 56677 97460 27379 780 820 16490 81877 28357 52226 73644 54413 22986 4...

result:

ok good answer on both questions!

Test #54:

score: 35
Accepted
time: 91ms
memory: 6516kb

input:

200000 17500
814841377 815037424
814978408 815046409
316136456 316189776
359845071 360032828
490229154 490276381
179918546 179966795
26399745 26574075
316038598 316221536
863004053 863187417
813480188 813592478
179760743 179956634
525783814 525983530
516451322 516505745
359707994 359873489
179938475...

output:

26498
99722 48066 40139 112060 138279 105233 43334 89805 21207 196911 7889 129413 58339 30978 133828 190424 192619 117098 86726 185557 96783 84428 60671 23806 47996 11320 192028 97602 147360 103588 183792 43512 178569 61430 33242 102426 177409 133081 75557 74592 102304 112791 197973 42782 98516 3737...

result:

ok good answer on both questions!

Test #55:

score: 35
Accepted
time: 73ms
memory: 6664kb

input:

300000 3
960992055 961089241
584069363 584155229
782676678 782778290
591608789 591748014
693990170 694124521
769927102 770036037
662005179 662054139
578741508 578801523
136827704 136972014
147415851 147557439
647851869 647959336
69858254 70006698
950381454 950515306
582992019 583140877
599178469 599...

output:

149226
32327 99468 291603 

result:

ok good answer on both questions!

Test #56:

score: 35
Accepted
time: 206ms
memory: 14220kb

input:

500000 100013
88620884 780846637
332338800 881462535
299651052 906346033
156688993 536474580
140593176 434239013
129228367 186806473
68602446 211469946
17188008 816321046
102940839 169934348
379634231 883354292
42801668 449461660
5079731 980820900
355810708 688001491
16661401 452183674
87890036 5657...

output:

606374390
477391 385066 297208 456061 173688 121122 213818 264013 172600 46184 146620 329964 166907 296764 199758 32210 368377 435355 277050 461618 216168 99590 477257 73999 335834 220338 137141 303426 200723 83323 226396 86218 401835 271530 376352 456469 429318 435612 382897 299508 426996 481475 15...

result:

ok good answer on both questions!

Test #57:

score: 35
Accepted
time: 566ms
memory: 43856kb

input:

1000000 531526
647675413 655428019
648596009 656680290
450695554 452194809
424533499 429796316
381177371 384017767
46931342 53994118
753699675 760019215
648512374 656056410
254699344 254931641
121708584 122040394
228773603 233958541
339252038 344949357
492311529 499336465
647489466 655343591
6477045...

output:

6522523
518502 569922 890012 540476 876392 789059 493491 253275 534242 512149 730268 221358 21314 569114 526112 463220 889459 984665 200925 895555 176993 541933 87330 211983 831672 258510 535159 650949 718586 393996 113737 866980 556617 378516 924288 360059 116701 937775 657869 414034 489549 751851 ...

result:

ok good answer on both questions!

Test #58:

score: 35
Accepted
time: 399ms
memory: 21320kb

input:

750000 178573
580383095 583943212
778317468 781859284
612941835 616007381
465968923 470152344
22230560 27116627
979106725 985021088
637544172 638587357
521296864 527100361
677936432 684323474
656691359 663072596
986695737 994033880
952210981 959646073
392839487 400006189
975582594 976079646
92139367...

output:

751739
657927 161073 262778 349785 437666 424369 253839 640571 626738 649945 384416 608221 594004 299761 388292 35561 618544 98362 125278 709970 466647 507223 546052 442521 184914 722548 453804 168829 494646 545751 282969 93978 258581 63618 556081 227371 143948 711470 170344 13432 418450 729800 2559...

result:

ok good answer on both questions!

Test #59:

score: 35
Accepted
time: 494ms
memory: 54212kb

input:

1000000 752785
649962746 718987598
132290609 232289040
757507761 788306828
831881130 864922336
754898434 782645236
732781385 776448679
759319830 799855647
720599522 809324810
762383181 796029504
743442598 842510031
70086181 76343603
450480563 534716948
740769775 818207515
709654846 787496036
7178471...

output:

4653016
281469 95706 628534 257579 462109 803841 192526 902872 302138 247614 86381 946037 783806 568430 967588 927492 542222 626862 952342 7183 244113 504793 894820 736786 243733 321184 541668 576131 563102 992900 773475 178191 786024 381874 855235 571315 279393 735266 658272 944143 13626 855282 520...

result:

ok good answer on both questions!

Test #60:

score: 35
Accepted
time: 558ms
memory: 18948kb

input:

1000000 73945
604020399 703897827
140071138 232651757
371859835 471335092
555243229 646303280
575590779 660169619
370167725 428219061
14524277 113206009
183129730 240956898
283540799 382726491
552653758 652166145
51302205 118102658
261530667 349695563
372085647 471552726
39324677 125591844
554406658...

output:

99139877
453869 591408 27282 897218 405090 716365 936374 6358 711287 737124 874179 198604 488233 57949 488689 35460 661503 60465 898717 8745 97339 854252 542079 850493 579429 778011 547545 367464 218883 538747 740608 639337 843627 778317 952813 536009 938038 358491 138188 930443 988597 808556 405845...

result:

ok good answer on both questions!

Test #61:

score: 35
Accepted
time: 496ms
memory: 40288kb

input:

1000000 500000
714 1202
794 1307
21 801
274 661
107 1290
523 1100
547 929
228 1303
462 1491
939 1051
486 754
284 1221
94 1150
187 1100
27 701
520 1195
999 1305
418 1062
236 1122
256 669
87 1322
632 1152
586 1401
531 1490
794 889
553 703
820 980
644 1324
832 1150
605 1245
825 1434
11 1482
198 1322
60...

output:

178
818641 53654 785714 44934 78814 474123 930542 940883 322033 734338 65655 561315 446807 212389 795150 847164 22816 41652 376176 389197 840097 116293 253447 625704 175859 587005 376029 631646 139300 539820 91504 564163 766449 209880 770577 510524 633758 256306 455347 205833 382912 401371 459728 57...

result:

ok good answer on both questions!

Test #62:

score: 35
Accepted
time: 170ms
memory: 14212kb

input:

500000 100000
23 999999990
43 999999993
44 999999982
20 999999991
12 999999970
28 999999990
46 999999994
48 999999974
5 999999973
26 999999984
20 999999974
35 999999991
49 999999963
24 999999995
6 999999986
11 999999970
6 1000000000
10 999999987
39 999999993
26 999999961
27 1000000000
13 999999958
8...

output:

999999955
462 836 2117 2838 5222 5374 7117 11922 12922 19237 20789 21905 22517 24561 25799 30779 34895 35084 40606 40861 42092 50060 50180 50989 52426 57672 61721 62599 64824 65949 70062 75001 84846 86890 94950 96822 97828 100710 102785 107407 108755 114696 115618 117886 118732 120200 121742 123251 ...

result:

ok good answer on both questions!

Test #63:

score: 35
Accepted
time: 179ms
memory: 14224kb

input:

500000 100000
50000019 50000026
50000023 50000032
50000050 50000057
50000043 50000057
50000007 50000041
50000041 50000042
50000022 50000057
50000014 50000067
50000043 50000063
50000030 50000058
50000047 50000054
50000033 50000060
50000003 50000027
50000010 50000066
50000014 50000054
50000044 5000005...

output:

34
389 983 3437 7856 8462 9064 11087 12097 12288 14348 21031 21724 23969 26901 28287 30321 31165 31381 32186 33395 34578 35246 35287 40759 42124 43121 44131 45563 48997 52281 54319 55276 57408 58363 59421 60496 68593 71227 72018 85636 87576 90556 91656 97425 98401 99217 99668 100158 101798 101868 10...

result:

ok good answer on both questions!