QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#783016#9632. 联通块daniel_lele35 48ms55932kbC++208.3kb2024-11-25 22:36:402024-11-25 22:36:45

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 0ms
memory: 51296kb

input:

1 500 25 500
160 300
95 345
131 498
259 359
400 394
445 137
75 145
126 185
86 336
44 98
271 32
73 227
2 1
39 420
487 38
356 240
447 193
70 26
46 171
436 272
260 485
393 66
297 351
192 88
326 245
174 416
4 9
399 194
58 350
256 176
376 248
2 59
77 7
59 148
258 173
352 34
9 320
221 244
3 1
284 193
335 ...

output:

456
450
12
500
153
8
4
33
3
10
432
500
420
396
93
228
2
500
20
340
6
475
1
0
13
256
500
308
396
15
421
500
500
500
32
67
450
128
500
153
420
2
0
432
18
6
92
308
85
500
0
1
33
500
8
228
500
1
367
475
228
450
500
432
420
218
142
20
500
8
14
500
500
218
500
341
456
450
37
4
0
1
1
162
228
500
500
99
148...

result:

ok 500 lines

Test #2:

score: 10
Accepted
time: 7ms
memory: 53324kb

input:

1 500 25 500
107 126
144 226
2 94
361 236
47 21
11 277
387 350
45 70
274 258
159 95
104 78
349 419
251 66
164 435
181 46
55 24
355 393
404 234
306 153
191 308
54 74
106 36
58 84
45 14
73 348
114 163
346 16
391 74
6 4
320 70
254 482
469 36
118 212
17 27
85 148
109 28
18 48
26 19
172 176
312 208
11 18...

output:

429
18
171
447
326
14
500
500
2
347
24
308
232
395
369
447
500
101
16
470
447
149
447
424
10
326
52
500
470
40
42
500
500
210
470
422
161
470
500
0
6
20
161
0
177
42
308
104
500
46
500
1
0
231
447
8
22
422
115
3
500
447
30
1
500
59
0
500
3
2
500
0
500
8
2
54
395
53
447
1
500
114
422
106
231
3
232
2
...

result:

ok 500 lines

Test #3:

score: 10
Accepted
time: 0ms
memory: 51264kb

input:

1 500 25 500
189 213
447 219
35 251
109 395
46 18
169 115
36 57
413 28
66 8
489 124
409 10
118 15
143 150
256 461
317 273
22 29
107 3
113 133
88 109
478 88
158 150
160 41
233 435
238 166
89 137
77 250
50 101
134 84
327 172
107 151
122 176
70 282
120 146
361 150
450 64
5 16
93 56
101 175
373 194
426 ...

output:

95
8
0
18
36
469
0
500
453
403
442
53
500
500
500
10
2
10
3
469
95
366
5
227
154
43
48
4
23
470
432
88
12
0
3
357
500
396
0
0
59
470
59
154
0
348
3
231
348
0
348
469
5
6
1
442
500
475
38
0
61
27
211
442
213
147
21
397
4
7
469
475
147
9
43
442
396
500
43
67
231
12
18
357
357
20
470
500
80
192
6
17
1
...

result:

ok 500 lines

Test #4:

score: 10
Accepted
time: 3ms
memory: 51324kb

input:

1 500 25 500
26 34
239 252
92 80
252 254
308 304
33 44
395 408
98 105
245 237
9 6
490 494
84 89
452 458
387 397
15 11
306 313
120 115
138 149
263 272
264 266
320 323
91 88
204 191
344 334
493 482
255 259
238 234
282 292
213 225
346 357
191 197
434 445
492 495
136 137
71 78
442 449
477 464
196 188
12...

output:

335
500
97
240
500
500
9
19
368
0
500
172
500
500
196
500
1
213
368
339
500
500
318
500
20
247
279
500
65
426
500
42
2
500
56
187
30
500
500
149
500
500
500
500
302
329
500
0
500
500
0
500
0
380
339
55
500
500
500
208
265
500
23
308
500
317
318
44
307
500
500
380
420
314
193
500
500
500
500
348
500
...

result:

ok 500 lines

Test #5:

score: 10
Accepted
time: 3ms
memory: 51276kb

input:

1 500 25 500
413 417
57 48
425 422
35 46
144 149
429 435
113 123
350 342
364 360
290 303
68 81
178 168
280 281
160 165
102 104
488 477
229 237
133 129
129 119
196 187
190 177
225 226
405 414
117 124
180 177
153 140
450 457
206 211
32 43
13 14
183 188
361 363
398 388
149 155
185 175
410 404
254 266
1...

output:

246
500
500
500
500
292
175
500
500
419
32
305
500
500
500
164
500
257
500
133
500
500
419
500
330
500
292
296
399
500
346
500
0
500
376
500
247
41
500
500
500
330
19
500
163
252
500
80
500
500
500
500
152
500
409
0
18
500
457
366
500
475
9
3
500
3
500
500
500
500
500
113
500
500
500
3
500
0
58
151
...

result:

ok 500 lines

Test #6:

score: 10
Accepted
time: 3ms
memory: 51324kb

input:

1 500 25 500
409 413
381 371
55 47
395 400
497 487
305 302
168 166
405 395
202 191
340 337
422 421
449 443
191 179
422 431
297 289
382 384
269 280
495 483
110 121
189 196
277 289
141 149
400 412
310 313
47 54
50 46
237 241
460 467
92 93
494 489
228 216
146 156
43 34
328 327
298 308
170 181
6 8
158 1...

output:

500
62
500
96
500
16
470
500
21
398
81
500
105
390
398
500
500
112
363
268
4
500
267
500
500
500
500
500
1
500
500
18
390
378
500
500
13
117
52
500
500
500
500
212
500
14
27
500
396
391
63
375
500
222
189
18
500
312
500
500
500
500
279
500
107
500
500
500
312
500
500
219
500
279
195
99
252
29
500
50...

result:

ok 500 lines

Test #7:

score: 10
Accepted
time: 4ms
memory: 51320kb

input:

1 500 25 500
172 183
392 411
20 24
330 339
146 182
58 67
61 111
381 419
114 96
213 261
187 162
260 287
144 109
108 72
90 81
217 181
148 166
365 393
280 300
368 334
362 361
149 93
209 212
208 169
200 144
49 10
50 38
218 160
350 370
327 278
249 218
38 44
124 179
46 44
280 251
415 441
462 484
468 494
2...

output:

66
98
456
500
223
340
169
216
434
51
8
33
16
208
77
78
500
173
133
500
192
0
195
141
107
88
500
96
20
190
374
144
80
500
360
318
500
441
14
500
150
5
500
220
234
14
13
58
8
9
500
0
158
0
281
500
304
334
340
263
15
307
277
318
400
500
0
71
15
426
2
10
0
500
159
202
225
132
27
3
25
500
157
99
475
0
11...

result:

ok 500 lines

Test #8:

score: 10
Accepted
time: 4ms
memory: 53364kb

input:

1 500 25 500
170 187
162 177
145 94
366 379
9 14
354 397
427 404
289 246
67 106
93 86
459 429
148 193
228 225
354 395
151 111
458 405
243 280
449 477
483 493
464 489
27 24
252 271
166 141
344 301
12 6
410 378
6 2
54 98
396 346
120 175
400 437
109 97
86 130
264 227
381 380
155 179
407 379
264 302
19 ...

output:

500
2
500
67
343
475
128
197
5
219
430
500
314
293
409
53
351
12
122
351
444
37
475
8
39
62
250
253
343
471
338
12
270
475
500
31
500
307
74
500
289
22
0
500
500
197
500
8
500
427
7
500
500
22
191
0
343
430
500
300
44
43
2
47
26
338
341
6
15
2
7
92
237
253
13
79
216
29
96
301
475
430
9
13
2
500
19
2...

result:

ok 500 lines

Test #9:

score: 10
Accepted
time: 4ms
memory: 53312kb

input:

1 500 25 500
209 246
129 88
12 14
320 271
296 300
48 55
155 156
386 406
95 85
139 85
152 144
370 398
412 369
88 142
154 142
484 457
170 113
439 425
363 332
18 30
302 279
277 316
276 255
249 260
366 345
308 357
3 11
364 368
466 413
383 374
18 17
479 440
88 86
80 102
118 92
205 214
498 450
430 388
173...

output:

202
251
500
126
157
346
295
44
500
5
56
123
329
4
64
392
465
264
298
500
4
5
154
13
249
6
212
289
39
64
500
412
36
10
465
23
1
81
2
138
500
500
304
500
0
251
404
425
130
500
0
11
369
288
32
241
271
500
102
241
128
460
0
384
401
228
66
5
13
9
124
80
384
427
21
253
384
11
249
355
86
1
154
332
276
3
39...

result:

ok 500 lines

Subtask #2:

score: 10
Accepted

Dependency #1:

100%
Accepted

Test #10:

score: 10
Accepted
time: 12ms
memory: 55744kb

input:

2 2000 50 2000
1423 1355
1791 890
145 1295
637 1018
413 1025
1127 649
955 904
108 55
893 971
1952 1944
400 41
453 357
731 95
291 368
40 1442
899 1022
1406 1862
547 1388
577 102
1035 1183
196 881
286 882
1022 1078
832 110
272 626
1326 197
636 569
29 19
188 241
219 82
1237 1334
44 53
113 44
354 9
132 ...

output:

5
2000
187
8
2000
65
323
2000
254
5
1449
2
188
146
1920
1704
2000
113
1664
47
31
37
3
984
2000
0
1920
17
0
373
1941
22
635
1
363
673
929
2000
361
282
0
3
1941
1402
2
1805
1878
934
1312
0
556
1402
2000
2000
1068
673
975
984
933
0
11
1068
2000
753
0
0
1
939
5
2000
1704
1711
2000
25
9
1676
2
1878
29
34...

result:

ok 2000 lines

Test #11:

score: 10
Accepted
time: 7ms
memory: 51716kb

input:

2 2000 50 2000
1142 1744
1321 1376
917 256
1413 493
422 199
1187 686
197 293
1846 1350
142 1535
197 114
1012 1847
468 591
378 291
255 79
1766 848
555 536
859 1098
727 96
1746 1038
1710 1684
273 407
336 1421
678 685
355 1602
648 1041
1071 9
1988 82
441 492
38 40
564 669
185 352
503 1961
472 1807
49 6...

output:

0
1915
0
4
753
2
1004
1389
83
331
1
1303
1212
1183
1915
220
13
2
1444
14
22
441
573
1821
131
0
1110
2000
448
8
746
168
201
1915
7
9
23
1863
1
11
2000
1371
1558
1004
22
245
1883
2000
1004
571
2000
0
307
1639
1883
2000
0
6
758
1858
1863
42
2000
1710
141
23
1832
2
88
294
2000
83
115
737
1453
48
1697
16...

result:

ok 2000 lines

Test #12:

score: 10
Accepted
time: 3ms
memory: 53800kb

input:

2 2000 50 2000
835 1292
1674 169
145 139
1267 570
415 1055
487 168
1274 788
58 41
115 414
1736 927
123 525
790 1368
902 1434
1916 1249
1019 1351
382 642
1837 1542
1759 774
971 1940
475 709
1457 1079
255 138
1479 1331
1884 431
346 1954
505 64
208 1361
662 129
1842 1385
251 952
1436 1456
60 1804
588 1...

output:

2000
2000
0
1789
1705
268
452
17
1705
2000
369
30
2000
1
1849
2000
0
2000
1870
2
1684
1892
2000
8
1
29
2000
2000
1910
18
2000
1910
18
2000
392
655
191
2000
1031
1419
2000
1218
2000
2000
2000
1710
2000
2000
1831
1849
12
498
712
2000
1798
9
0
155
294
2000
2000
1910
133
9
20
1667
2000
1833
2000
1870
43...

result:

ok 2000 lines

Test #13:

score: 10
Accepted
time: 11ms
memory: 51760kb

input:

2 2000 50 2000
1975 1973
1010 1000
1526 1536
271 257
193 202
1450 1455
1684 1699
1 2
698 699
799 788
1186 1187
917 921
534 531
1252 1254
1803 1811
627 621
186 191
818 813
1703 1712
616 625
1491 1501
567 560
882 892
1780 1769
1190 1186
1377 1392
1541 1555
660 672
400 411
167 180
1726 1723
1874 1883
3...

output:

611
110
2000
583
2000
106
2000
2000
2000
1906
1122
2000
1592
2000
2000
2000
2000
1219
518
2000
1933
1875
1837
2000
1749
650
2000
2000
142
2000
2000
1291
963
2000
2000
1897
2000
2000
533
2000
1900
1164
2000
2000
2000
2000
1909
2000
2000
1647
2000
1179
97
2000
1024
58
50
2000
1728
2000
1844
354
2000
2...

result:

ok 2000 lines

Test #14:

score: 10
Accepted
time: 12ms
memory: 55932kb

input:

2 2000 50 2000
491 501
1680 1681
1631 1646
1581 1577
1895 1901
1281 1280
667 662
1720 1722
696 708
918 919
1352 1357
213 221
255 245
1590 1599
1070 1068
96 83
497 509
401 399
1320 1314
418 426
704 719
1016 1006
1606 1607
1498 1496
47 40
908 904
1801 1796
1312 1316
1717 1720
520 527
424 423
1087 1078...

output:

1009
2000
2000
1468
1277
2000
2000
2000
2000
1728
2000
2000
2000
818
1372
541
2000
2000
2000
1158
2000
7
2000
1495
1656
2000
1946
207
708
1318
2000
1490
1948
1348
585
1728
2000
2000
145
1166
1292
2000
620
2000
2000
2000
1090
2000
2000
2000
1250
1001
2000
2000
769
1845
1284
2000
2000
1292
2000
1816
2...

result:

ok 2000 lines

Test #15:

score: 10
Accepted
time: 16ms
memory: 53688kb

input:

2 2000 50 2000
434 448
421 416
1268 1263
561 576
1132 1146
653 640
870 862
695 703
853 840
1064 1067
96 90
1430 1442
898 904
1607 1598
1316 1318
1238 1227
685 687
437 442
1260 1275
686 699
1388 1402
1993 1994
1237 1236
1984 1985
1387 1390
1711 1704
309 322
1896 1906
1834 1821
1376 1378
1304 1298
108...

output:

6
421
2000
2000
2000
2000
2000
2000
2000
2000
2000
1504
2000
2000
1083
2000
1116
2000
2000
1513
2000
2000
1670
1720
2000
1092
1055
2000
2000
2000
490
1098
2000
2000
2000
2000
1761
1474
933
1086
2000
1287
16
84
380
1782
2000
2000
460
54
2000
1145
2000
1393
1669
392
943
1791
561
1264
561
859
2000
2000...

result:

ok 2000 lines

Test #16:

score: 10
Accepted
time: 13ms
memory: 55852kb

input:

2 2000 50 2000
1536 1490
1623 1616
631 615
23 67
256 197
1800 1735
1164 1278
1144 1038
894 960
16 122
402 466
75 105
757 662
683 761
1162 1057
1139 1155
1605 1649
713 663
1047 991
845 860
925 841
1899 1870
1068 977
579 477
1165 1252
1741 1828
1397 1447
877 977
1391 1491
181 229
1614 1629
659 576
139...

output:

922
274
417
995
351
2000
1675
730
307
645
51
219
1
35
2000
1525
2000
3
2000
1687
1256
1368
669
51
312
105
1022
1368
2000
1194
2000
22
1742
40
3
47
194
727
2000
36
1604
261
363
2000
1150
16
922
57
1690
1950
717
503
1
23
444
1053
60
3
1112
48
1514
79
33
2000
168
381
0
2000
1138
168
402
856
380
1495
19...

result:

ok 2000 lines

Test #17:

score: 10
Accepted
time: 12ms
memory: 53560kb

input:

2 2000 50 2000
1059 1149
1395 1302
613 566
1443 1381
1975 1896
1839 1917
1346 1256
1027 920
1219 1309
1270 1340
1742 1682
42 51
1817 1729
260 175
683 653
1024 1106
1023 942
1735 1690
1645 1551
387 501
582 656
856 822
380 268
643 618
1285 1297
429 379
641 750
446 523
1205 1312
1412 1424
1768 1883
151...

output:

1284
1270
822
387
2
1947
2000
2000
1605
349
656
333
804
837
372
176
745
3
2000
1069
329
2000
1265
317
498
287
890
329
34
1877
1454
2000
1850
83
61
1947
106
2
837
1862
309
1247
2000
1634
423
1341
441
2000
129
1950
1590
73
1538
66
2000
1816
1705
44
504
1756
426
482
36
123
178
1398
132
1375
924
1097
10...

result:

ok 2000 lines

Test #18:

score: 10
Accepted
time: 15ms
memory: 55748kb

input:

2 2000 50 2000
1545 1576
413 412
1120 1136
1186 1142
1727 1839
1034 1051
1239 1183
543 591
1874 1858
1232 1174
475 401
853 933
1266 1348
1008 1007
1395 1366
952 891
1188 1165
1701 1726
1243 1229
521 450
552 544
673 690
696 750
682 783
1868 1800
1322 1426
905 897
677 756
978 1035
965 969
1448 1346
41...

output:

2000
9
467
543
18
1586
258
41
1058
1060
1124
2000
5
2000
138
1675
192
159
1718
1008
22
292
2000
956
2000
2000
1008
121
2000
33
153
963
2000
2000
30
2000
2000
1144
731
251
2000
82
2000
1641
53
1229
49
78
861
956
1633
28
2000
249
2000
34
965
1157
498
753
156
487
565
518
2000
612
2000
229
1806
2000
160...

result:

ok 2000 lines

Subtask #3:

score: 15
Accepted

Test #19:

score: 15
Accepted
time: 43ms
memory: 36840kb

input:

3 100000 316 100000
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 ...

output:

7116
18702
30685
89626
91900
68029
99856
24514
99856
21550
958
63513
67890
69627
81017
45120
25573
23339
99856
48788
69094
79557
76332
41540
65799
99856
90842
99856
32381
48306
69788
25982
99856
69144
99856
17666
77905
97107
86289
99856
85158
66764
63052
16065
95112
30243
64004
68333
76813
99856
910...

result:

ok 100000 lines

Test #20:

score: 15
Accepted
time: 43ms
memory: 36904kb

input:

3 100000 316 100000
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 ...

output:

10015
74652
50243
65090
73508
75718
99856
99856
99856
95576
29751
14262
57510
57264
99856
5937
38610
2328
77394
99856
89756
54138
80485
86024
32182
99856
59748
48953
66530
99856
84516
58145
99856
63032
80970
99856
99856
3945
99856
93385
12520
50127
87819
89913
47464
99856
81560
81019
53395
9623
3767...

result:

ok 100000 lines

Test #21:

score: 15
Accepted
time: 41ms
memory: 38660kb

input:

3 100000 316 100000
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 ...

output:

99856
99856
99856
99856
50718
99856
69275
24315
89556
87309
50041
93165
53745
25011
99856
42078
31147
99856
99856
53269
99856
70462
71903
15651
51108
77294
42794
76694
20334
99856
85737
88288
71878
46679
7090
56259
41696
54253
13634
99856
99856
35761
83738
63697
53828
38779
24648
88262
54147
88185
3...

result:

ok 100000 lines

Test #22:

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

input:

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

output:

23346
93425
10413
100000
48330
100000
36951
80129
17434
100000
77500
100000
100000
118
30571
10398
85975
84256
24721
52893
100000
20739
24371
65027
93697
51684
100000
74085
99062
76826
100000
16064
67828
51049
51291
3299
59621
100000
32754
34095
26308
64825
38751
100000
76043
90337
71601
32142
95533...

result:

ok 100000 lines

Test #23:

score: 15
Accepted
time: 48ms
memory: 35224kb

input:

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

output:

76843
59847
56242
37475
100000
100000
50097
57146
95889
68810
93468
91438
82945
85819
75690
100000
86824
100000
29266
100000
21464
80995
1636
100000
32757
83791
98372
28301
100000
100000
74010
100000
69931
2766
24305
45797
100000
31395
100000
56939
73636
91193
100000
48603
100000
89533
65137
100000
...

result:

ok 100000 lines

Test #24:

score: 15
Accepted
time: 34ms
memory: 37084kb

input:

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

output:

100000
100000
98884
22455
3777
99477
74993
69573
77981
92696
90334
37440
100000
5712
100000
45897
45667
100000
100000
88979
42527
89482
100000
64273
89918
65626
37836
37387
100000
57577
46959
13268
40920
33974
62514
51743
100000
81962
76080
93652
92825
51070
100000
79023
79748
83708
24836
72715
3455...

result:

ok 100000 lines

Test #25:

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

input:

3 100000 5000 100000
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50...

output:

87217
82002
100000
59429
74730
100000
78476
100000
62492
35730
3978
82420
66389
100000
82797
74837
86444
84263
69491
77263
60822
21044
100000
56671
53972
100000
78354
94901
19671
79256
22709
82427
42536
35257
100000
76139
100000
1431
66396
73077
93268
60577
81767
60303
28012
64072
71495
31360
100000...

result:

ok 100000 lines

Test #26:

score: 15
Accepted
time: 31ms
memory: 36840kb

input:

3 100000 5000 100000
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50...

output:

100000
67436
79064
16131
81070
100000
58268
28248
100000
82149
65947
100000
59054
72152
70142
100000
100000
75403
100000
64722
100000
38772
21518
115
69310
47232
100000
8098
91011
55812
20884
87262
82372
52600
63500
100000
74300
100000
62227
74299
100000
93722
1199
57311
60543
100000
33144
100000
27...

result:

ok 100000 lines

Test #27:

score: 15
Accepted
time: 42ms
memory: 36616kb

input:

3 100000 5000 100000
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50...

output:

83203
100000
66244
100000
56348
23615
100000
100000
100000
7549
84225
100000
86951
62679
87129
4189
74949
100000
78906
73386
58608
74219
61534
80287
30712
94467
100000
63398
35709
10548
64162
41104
77343
69569
38819
16872
53540
88081
88053
89054
38595
18183
52086
42475
52097
71060
100000
67187
14653...

result:

ok 100000 lines

Subtask #4:

score: 0
Time Limit Exceeded

Test #28:

score: 0
Time Limit Exceeded

input:

4 100000 50000 100000
83534 91958
44638 83107
30555 37613
47320 11817
17145 22205
3821 9581
12272 20812
293 1463
2550 2641
179 16579
28031 50662
15687 18932
6940 24780
31978 15599
17053 41795
56716 41026
32760 49030
96468 81779
44875 24089
67246 61768
44737 15873
64089 12670
7530 36388
68738 5284
32...

output:

21524
1
29017
1273
0
43127
49904
5
46274
50
54
5332
48504
33938
46141
100000
1097
1
4
473
29145
47147
49975
249
6436
385
100000
11564
49165
100000
5048
49968
21545
7628
100000
49957
27075
33909
194
34154
1
35144
100000
2
747
48824
49904
129
28
0
38866
45922
95
138
100000
100000
30070
0
1
51
1361
136...

result:


Subtask #5:

score: 0
Skipped

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #5:

0%