QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#112110#4742. PrawnicyLeticiaFCS100 ✓492ms42716kbC++20949b2023-06-10 03:53:592023-06-10 03:54:03

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-10 03:54:03]
  • 评测
  • 测评结果:100
  • 用时:492ms
  • 内存:42716kb
  • [2023-06-10 03:53:59]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

using lint = int64_t;

int main(){
    cin.tie(0)->sync_with_stdio(false);
    int n, k;
    cin>>n>>k;
    using pii = pair<lint, lint>;
    vector<pii> law(n), orglaw;
    for(auto &inter : law)
        cin>>inter.first>>inter.second;
    orglaw = law;
    sort(law.begin(), law.end());
    priority_queue<lint, vector<lint>, greater<lint>> pq;
    
    tuple<lint, lint, lint> ans = {0,-1e9,1e9};
    
    for(const auto &[l, r] : law){
        
        pq.push(r);
        if(pq.size() > k) pq.pop();
        if(pq.size() == k){
            lint max_r = pq.top();
            ans = max(ans, {max_r-l, l, max_r});
        }
    }

    auto [val, l, r] = ans;
    cout<<val<<"\n";
    for(int i =0; i<n; i++)
        if(k && orglaw[i].first <= l && r <= orglaw[i].second){
            k--;
            cout<<i+1<<" ";
        }
    cout<<"\n";
    return 0;
}

詳細信息

Subtask #1:

score: 20
Accepted

Test #1:

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

input:

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

output:

4
2 4 5 

result:

ok good answer on both questions!

Test #2:

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

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: 2ms
memory: 3340kb

input:

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

output:

3
5 6 

result:

ok good answer on both questions!

Test #4:

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

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

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

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

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

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: 2ms
memory: 3344kb

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: 2ms
memory: 3448kb

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
1 3 4 14 15 

result:

ok good answer on both questions!

Test #11:

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

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

result:

ok good answer on both questions!

Test #12:

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

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: 2ms
memory: 3456kb

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

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

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

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

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

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

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

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

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: 2ms
memory: 3408kb

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

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

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

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 42 46 48 49 54 55 56 58 60 65 67 70 71 75 77 78 82 84 94 97 98 100 101 103 108 115 116 118 120 121 125 126 128 131 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 221 227 228 231 234 235 237 240 244 245 246 ...

result:

ok good answer on both questions!

Test #27:

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

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 45 49 59 61 64 69 84 85 87 93 101 106 107 109 114 125 133 134 136 143 145 147 148 153 156 164 165 178 180 183 208 219 221 228 243 245 247 249 250 257 271 272 291 292 294 297 

result:

ok good answer on both questions!

Test #28:

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

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 40 43 49 51 52 57 58 63 64 65 71 72 73 75 79 82 89 92 95 96 106 108 111 113 121 122 123 124 128 133 135 142 145 148 151 162 163 164 168 170 174 176 185 186 189 190 191 195 196 204 207 211 212 213 220 225 226 227 231 234 245 247 249 250 261 263 264 268 270 271 

result:

ok good answer on both questions!

Test #29:

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

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

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: 2ms
memory: 3372kb

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 12 25 26 32 43 47 61 67 69 74 89 90 96 102 103 138 140 142 148 154 158 179 187 188 201 208 212 220 235 

result:

ok good answer on both questions!

Test #32:

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

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 26 32 59 62 64 65 70 114 115 126 184 185 198 201 214 216 217 226 231 243 245 256 264 265 269 277 288 293 

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

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

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
1000 

result:

ok good answer on both questions!

Test #35:

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

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

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: 2ms
memory: 3388kb

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
10 99 133 188 240 246 329 343 387 406 489 490 505 524 526 532 535 561 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: 3428kb

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: 3ms
memory: 3628kb

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: 3ms
memory: 3476kb

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: 3ms
memory: 3612kb

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: 4ms
memory: 3568kb

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: 2ms
memory: 3512kb

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 991 1115 1121 1127 1157 1163 1175 1187 1217 1218 1221 1242 1256 1274 1276 1378 1390 1508 1517 1...

result:

ok good answer on both questions!

Subtask #4:

score: 15
Accepted

Test #44:

score: 15
Accepted
time: 190ms
memory: 23196kb

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

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: 45ms
memory: 7712kb

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: 116ms
memory: 18580kb

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: 316ms
memory: 42704kb

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

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: 347ms
memory: 42700kb

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: 249ms
memory: 34880kb

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: 213ms
memory: 42636kb

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: 31ms
memory: 6572kb

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
2 7 16 18 21 30 35 44 45 46 51 55 63 75 85 93 97 104 105 106 107 116 120 122 125 126 127 131 133 137 142 144 145 150 153 157 160 168 184 191 194 198 207 210 213 217 222 227 229 230 239 241 242 247 255 258 263 269 276 277 279 282 283 284 286 290 292 295 298 301 310 312 313 319 320 322 327 33...

result:

ok good answer on both questions!

Test #54:

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

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
9 27 28 35 48 49 52 96 127 133 153 154 159 169 178 186 199 205 223 224 271 273 296 308 310 315 325 332 334 367 381 382 385 387 398 411 439 466 471 474 481 513 551 554 589 590 602 616 624 632 638 641 645 656 665 677 689 706 715 719 725 726 743 765 770 793 804 807 832 835 842 849 862 865 873 880...

result:

ok good answer on both questions!

Test #55:

score: 35
Accepted
time: 74ms
memory: 12480kb

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: 157ms
memory: 19644kb

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
1 8 12 17 19 22 35 37 41 45 57 76 77 81 99 104 108 116 118 119 125 126 129 138 139 140 141 147 148 154 158 160 161 164 168 174 178 188 190 191 199 200 205 213 219 225 226 231 232 233 237 240 243 244 248 252 259 260 262 272 278 285 287 290 296 297 305 311 317 321 328 331 336 339 343 345 360...

result:

ok good answer on both questions!

Test #57:

score: 35
Accepted
time: 363ms
memory: 42716kb

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
1 2 8 14 15 18 19 21 22 24 27 29 31 32 33 35 36 37 40 42 43 44 46 47 51 52 53 55 57 59 60 62 65 66 67 68 69 70 71 72 73 74 75 78 80 82 84 85 86 90 93 94 96 99 100 102 103 104 108 110 111 113 115 119 122 124 126 127 130 131 134 135 137 138 139 140 142 144 146 147 148 152 153 154 157 158 159 1...

result:

ok good answer on both questions!

Test #58:

score: 35
Accepted
time: 264ms
memory: 28512kb

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
10 16 31 36 41 44 46 47 48 50 52 63 64 65 71 86 90 101 104 108 113 121 125 126 129 140 141 143 151 157 158 159 162 163 166 171 181 183 185 191 195 196 199 201 205 206 207 208 210 222 224 229 234 237 248 257 260 261 263 267 270 271 275 277 278 281 292 299 323 327 336 338 339 340 346 348 349 35...

result:

ok good answer on both questions!

Test #59:

score: 35
Accepted
time: 492ms
memory: 42640kb

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
3 5 6 7 8 9 10 13 14 15 16 17 18 19 22 23 26 27 28 29 31 32 33 34 35 36 37 38 45 46 47 48 49 50 51 52 53 54 55 56 57 60 61 62 64 65 67 68 70 71 72 73 74 75 76 77 78 79 80 81 84 85 87 88 89 90 91 92 94 95 97 98 100 101 102 105 106 107 109 110 111 113 114 115 116 117 118 119 120 121 122 124 12...

result:

ok good answer on both questions!

Test #60:

score: 35
Accepted
time: 359ms
memory: 35324kb

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
3 13 19 28 52 54 62 94 103 123 125 127 154 157 160 166 190 223 249 259 278 286 294 310 333 343 349 353 376 396 405 406 411 412 428 448 453 458 465 467 493 508 510 531 538 600 607 609 629 639 644 659 663 669 733 759 771 775 778 781 804 820 829 855 862 870 906 908 927 933 938 943 944 949 956 ...

result:

ok good answer on both questions!

Test #61:

score: 35
Accepted
time: 300ms
memory: 38508kb

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
5 6 7 8 9 12 13 14 16 18 19 21 22 23 24 28 30 32 33 34 37 40 41 42 45 46 48 49 50 51 52 53 54 56 57 58 60 62 64 66 69 71 73 74 77 82 85 86 88 89 90 91 92 93 95 98 99 100 101 102 103 106 109 111 114 116 117 118 121 122 123 124 125 126 128 129 130 131 133 134 139 141 142 144 145 146 148 150 155 15...

result:

ok good answer on both questions!

Test #62:

score: 35
Accepted
time: 152ms
memory: 19644kb

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
1 4 10 14 15 17 18 21 23 25 32 47 50 67 70 74 76 77 83 84 91 94 96 97 102 107 112 117 129 138 140 145 146 148 152 155 157 158 161 162 163 166 169 180 191 194 198 201 203 219 238 245 247 248 249 252 256 258 261 262 265 266 268 272 282 285 291 293 295 296 301 304 305 308 311 316 322 324 325 ...

result:

ok good answer on both questions!

Test #63:

score: 35
Accepted
time: 145ms
memory: 19664kb

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
8 14 23 27 31 32 36 45 48 55 66 85 88 94 99 102 105 106 125 129 131 132 134 136 144 146 153 156 161 163 166 169 174 185 189 193 198 199 210 219 226 234 240 257 266 281 287 296 300 302 303 309 314 316 319 320 322 323 324 333 334 335 336 346 356 371 372 377 381 383 386 387 395 397 416 418 420 422 4...

result:

ok good answer on both questions!