QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#112119#4742. PrawnicyHuangHanSheng65 479ms22592kbC++171.1kb2023-06-10 05:22:132023-06-10 05:22:16

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 20
Accepted

Test #1:

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

input:

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

output:

4
1 2 4

result:

ok good answer on both questions!

Test #2:

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

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
1 3 6 7 8 12 13

result:

ok good answer on both questions!

Test #3:

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

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: 3436kb

input:

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

output:

12
3 4 8

result:

ok good answer on both questions!

Test #5:

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

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
1 2 6 12 13 14 16

result:

ok good answer on both questions!

Test #6:

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

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
5 8 14 18

result:

ok good answer on both questions!

Test #7:

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

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
5 12 15 16 17

result:

ok good answer on both questions!

Test #8:

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

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
2 4 7 9 10 12 13 16 19 20

result:

ok good answer on both questions!

Test #9:

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

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
6 7 12 19

result:

ok good answer on both questions!

Test #10:

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

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: 3456kb

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
2 5 8 16 17

result:

ok good answer on both questions!

Test #12:

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

input:

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

output:

6
1 3 5

result:

ok good answer on both questions!

Test #13:

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

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
1 2 3 4 5 8 9 10 11 12 16 17

result:

ok good answer on both questions!

Test #14:

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

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: 0ms
memory: 3360kb

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
1 4 5 7 8

result:

ok good answer on both questions!

Test #16:

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

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
3 4

result:

ok good answer on both questions!

Test #17:

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

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
4 10 11 18 19

result:

ok good answer on both questions!

Test #18:

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

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
2 4 6 16 17

result:

ok good answer on both questions!

Test #19:

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

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
2 3 7 9 10 11 12 16 17 20

result:

ok good answer on both questions!

Test #20:

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

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
2 3 5 7 9 11 18

result:

ok good answer on both questions!

Test #21:

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

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 17 20

result:

ok good answer on both questions!

Test #22:

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

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 7 9 11 13

result:

ok good answer on both questions!

Subtask #2:

score: 15
Accepted

Test #23:

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

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
3 10 31 38 64 65 76 87 101 107 116 134 140 147 157 160 164 182 185 188 203

result:

ok good answer on both questions!

Test #24:

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

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
2 8 14 22 26 34 40 50 65 66 68 76 81 86 98 102 106 110 113 127 130 141 156 159 172 185 186 189 198 221 222 224 231

result:

ok good answer on both questions!

Test #25:

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

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
6 15 21 44 49 50 68 74 78 86 89 109 113 124 138 141 146

result:

ok good answer on both questions!

Test #26:

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

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
12 17 19 23 25 28 35 38 42 46 48 49 54 55 56 58 60 62 65 67 70 71 75 77 78 82 84 94 97 98 100 101 103 108 115 116 118 120 121 125 126 128 132 136 138 140 141 143 148 157 158 162 164 166 168 170 171 174 176 177 179 190 196 202 206 210 211 212 215 217 218 228 231 234 235 237 240 244 245 246 247 25...

result:

ok good answer on both questions!

Test #27:

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

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

result:

ok good answer on both questions!

Test #28:

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

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

result:

ok good answer on both questions!

Test #29:

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

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
13 38 45 85 92 108 125 139 152 177 191 198 220 255 274 275 285

result:

ok good answer on both questions!

Test #30:

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

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

result:

ok good answer on both questions!

Test #31:

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

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
1 9 13 28 29 56 61 67 83 97 99 107 116 122 131 142 148 149 154 162 167 177 178 181 186 223 228 239 258 287

result:

ok good answer on both questions!

Test #32:

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

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
8 15 19 26 30 53 64 71 114 121 122 126 127 132 135 140 153 157 160 165 185 202 221 226 231 249 260 265 269 282

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: 3372kb

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: 1ms
memory: 3380kb

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: 1ms
memory: 3420kb

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
1 9 13 14 23 40 42 48 73 85 94 95 97 123 133 141 149 164 166 170 172 175 177 182 183 198 199 212 218 223 232 250 259 260 262 272 287 328 329 337 341 344 345 353 367 374 379 380 381 384 413 425 437 443 446 450 478 484 495 510 517 522 525 526 528 532 538 542 549 558 565 570 573 599 600 609 611...

result:

ok good answer on both questions!

Test #36:

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

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
6 9 26 34 42 49 51 58 61 69 71 81 87 95 107 108 110 114 116 122 140 146 147 151 154 157 159 169 183 185 187 191 200 201 207 208 212 218 224 225 229 241 245 251 254 275 277 279 284 286 291 301 303 319 325 326 339 343 344 356 362 365 367 369 376 377 381 395 401 402 418 445 446 447 449 459 463 472 ...

result:

ok good answer on both questions!

Test #37:

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

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
99 133 188 240 246 329 343 387 406 489 490 505 524 526 532 535 561 614 623 630 645 697 768 780 853 877 889 915 993

result:

ok good answer on both questions!

Test #38:

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

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
295 715 929 1098 1137 1214 1339 1699 1749

result:

ok good answer on both questions!

Test #39:

score: 15
Accepted
time: 15ms
memory: 3432kb

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
1 13 15 20 42 46 65 86 102 104 117 118 121 139 145 157 168 174 177 195 215 224 228 248 249 254 258 259 260 262 269 276 298 319 331 334 363 374 383 397 401 403 442 448 480 491 500 502 503 509 513 520 544 545 551 562 566 572 578 606 614 628 646 648 649 660 663 669 700 713 723 724 747 754 764...

result:

ok good answer on both questions!

Test #40:

score: 15
Accepted
time: 6ms
memory: 3392kb

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
23 46 51 53 75 125 157 189 255 346 351 352 358 359 362 424 446 468 496 503 517 562 592 598 611 617 679 689 709 740 767 810 831 856 867 895 902 936 967 970 1007 1009 1012 1027 1037 1039 1040 1077 1097 1106 1165 1168 1200 1207 1214 1247 1254 1259 1297 1347 1354 1361 1362 1367 1374 1430 1476 1...

result:

ok good answer on both questions!

Test #41:

score: 15
Accepted
time: 40ms
memory: 3432kb

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
3 9 10 13 14 15 16 17 20 30 32 38 39 47 49 52 59 72 82 83 84 96 97 100 107 110 112 115 116 117 118 120 124 129 137 140 144 146 152 155 157 158 160 161 162 164 165 168 172 173 174 175 177 178 180 181 183 184 195 202 206 211 218 219 222 223 225 227 228 235 242 246 247 250 258 262 269 270 271...

result:

ok good answer on both questions!

Test #42:

score: 15
Accepted
time: 8ms
memory: 3516kb

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
48 59 66 87 118 161 198 222 228 253 262 264 268 285 313 390 396 414 461 485 519 531 580 588 652 739 747 761 768 808 832 852 926 953 968 972 973 980 985 1018 1024 1041 1100 1109 1113 1116 1120 1123 1175 1209 1217 1241 1267 1290 1350 1382 1390 1393 1395 1398 1409 1466 1501 1516 1538 1540 154...

result:

ok good answer on both questions!

Test #43:

score: 15
Accepted
time: 8ms
memory: 3416kb

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
35 43 110 115 118 135 159 212 216 225 253 260 270 307 326 333 343 366 384 405 429 431 441 467 493 511 540 561 615 622 623 651 662 687 694 710 711 713 720 741 746 755 765 822 891 906 936 937 958 966 978 1115 1121 1127 1157 1163 1175 1187 1217 1218 1221 1242 1256 1274 1276 1378 1390 1508 1517 1540 ...

result:

ok good answer on both questions!

Subtask #4:

score: 15
Accepted

Test #44:

score: 15
Accepted
time: 199ms
memory: 13100kb

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

result:

ok good answer on both questions!

Test #45:

score: 15
Accepted
time: 7ms
memory: 3564kb

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

result:

ok good answer on both questions!

Test #46:

score: 15
Accepted
time: 33ms
memory: 4856kb

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: 121ms
memory: 8832kb

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: 479ms
memory: 22592kb

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

result:

ok good answer on both questions!

Test #49:

score: 15
Accepted
time: 62ms
memory: 5908kb

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: 459ms
memory: 22516kb

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

result:

ok good answer on both questions!

Test #51:

score: 15
Accepted
time: 343ms
memory: 17788kb

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
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 #52:

score: 15
Accepted
time: 282ms
memory: 22524kb

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: 0
Time Limit Exceeded

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #53:

score: 0
Time Limit Exceeded

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:


result: