QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#136276#2412. Canvas LineNightW0lf#AC ✓5ms4012kbC++232.1kb2023-08-07 18:41:162023-08-07 18:41:17

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-07 18:41:17]
  • Judged
  • Verdict: AC
  • Time: 5ms
  • Memory: 4012kb
  • [2023-08-07 18:41:16]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long 

vector<pair<int, int>> pts;
vector<pair<int, int>> edges;
map<int, bool> is_point;




signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n; cin >> n;

    for(int i = 1; i <= n; i++) {
    
        int l, r; cin >> l >> r;
        edges.push_back({l, r});
    
    }

    sort(edges.begin(), edges.end());
    vector<int> edge_have(n + 1);
    int p; cin >> p;
    
    for(int i = 1; i <= p; i++) {
    
        int x; cin >> x;
        pts.push_back({x, 1});
        is_point[x] = 1;

        for(int j = 0; j < n; j++) {
            if(edges[j].first <= x and edges[j].second >= x) edge_have[j]++; 
        }
    }


    vector<pair<int, int>> calc;

    for(int i = 0; i < n - 1; i++) {
        if(edges[i].second == edges[i + 1].first) {
            calc.push_back({1, edges[i].second});
        }
    }

    for(auto x: edges) {
        int l = x.first;
        int r = x.second;
        calc.push_back({0, (l + r) / 2});
        calc.push_back({0, (l + r) / 2 + 1});
    }

    sort(calc.begin(), calc.end(), greater<pair<int, int>>());
    vector<int> res;


    for(auto x: calc) {
        if(is_point[x.second]) continue;
        int flag = 0;
        for(int i = 0; i < n; i++) {
            if(edges[i].first <= x.second and edges[i].second >= x.second) {
                if(edge_have[i] >= 2) flag = 2;
                else flag = max(flag, 1LL);
            }
        }
        
        if(flag == 1) {
            res.push_back(x.second);
            for(int i = 0; i < n; i++) {
                if(edges[i].first <= x.second and edges[i].second >= x.second) {
                    edge_have[i]++;
                }
            }
        }
    }

    for(int i = 0; i < n; i++) {
        if(edge_have[i] != 2) {
            cout << "impossible\n";
            return 0;
        }
    }

    int sz = res.size();
    cout << sz << "\n";
    for(auto x: res) cout << x << " ";
    cout << "\n";
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3580kb

input:

5
0 100
100 200
200 300
300 400
400 500
2
100 200

output:

4
400 300 451 51 

result:

ok 

Test #2:

score: 0
Accepted
time: 1ms
memory: 3548kb

input:

20
0 100
100 200
200 300
300 400
400 500
500 600
600 700
700 800
800 900
900 1000
1000 1100
1100 1200
1200 1300
1300 1400
1400 1500
1500 1600
1600 1700
1700 1800
1800 1900
1900 2000
3
300 900 2000

output:

18
1900 1800 1700 1600 1500 1400 1300 1200 1100 1000 800 700 600 500 400 200 100 51 

result:

ok 

Test #3:

score: 0
Accepted
time: 1ms
memory: 3560kb

input:

300
0 10
10 20
20 30
30 40
40 50
50 60
60 70
70 80
80 90
90 100
100 110
110 120
120 130
130 140
140 150
150 160
160 170
170 180
180 190
190 200
200 210
210 220
220 230
230 240
240 250
250 260
260 270
270 280
280 290
290 300
300 310
310 320
320 330
330 340
340 350
350 360
360 370
370 380
380 390
390 ...

output:

299
2990 2980 2970 2960 2950 2940 2930 2920 2910 2900 2890 2880 2870 2860 2850 2840 2830 2820 2810 2800 2790 2780 2770 2760 2750 2740 2730 2720 2710 2700 2690 2680 2670 2660 2650 2640 2630 2620 2610 2600 2590 2580 2570 2560 2550 2540 2530 2520 2510 2500 2490 2480 2470 2460 2450 2440 2430 2420 2410 2...

result:

ok 

Test #4:

score: 0
Accepted
time: 0ms
memory: 3480kb

input:

1
9000 9020
2
8990 9030

output:

2
9011 9010 

result:

ok 

Test #5:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

2
0 10
10 20
1
10

output:

2
16 6 

result:

ok 

Test #6:

score: 0
Accepted
time: 1ms
memory: 3468kb

input:

2
0 10
10 20
1
0

output:

2
10 16 

result:

ok 

Test #7:

score: 0
Accepted
time: 1ms
memory: 3504kb

input:

3
0 20
20 30
30 50
4
0 10 40 50

output:

2
26 25 

result:

ok 

Test #8:

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

input:

2
3000 13000
13010 13100
5
9120 11900 13000 13010 13090

output:

impossible

result:

ok 

Test #9:

score: 0
Accepted
time: 1ms
memory: 3632kb

input:

1
10 10000
1000
100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2100 2200 2300 2400 2500 2600 2700 2800 2900 3000 3100 3200 3300 3400 3500 3600 3700 3800 3900 4000 4100 4200 4300 4400 4500 4600 4700 4800 4900 5000 5100 5200 5300 5400 5500 5600 5700 5800 590...

output:

impossible

result:

ok 

Test #10:

score: 0
Accepted
time: 0ms
memory: 3528kb

input:

4
0 18
18 28
28 40
49 60
4
6 12 35 60

output:

3
28 55 24 

result:

ok 

Test #11:

score: 0
Accepted
time: 1ms
memory: 3468kb

input:

2
0 10
20 30
2
0 10

output:

2
26 25 

result:

ok 

Test #12:

score: 0
Accepted
time: 0ms
memory: 3468kb

input:

2
0 10
10 20
0


output:

3
10 16 6 

result:

ok 

Test #13:

score: 0
Accepted
time: 1ms
memory: 3468kb

input:

4
500 510
510 520
530 540
540 550
3
510 520 540

output:

3
546 536 506 

result:

ok 

Test #14:

score: 0
Accepted
time: 3ms
memory: 3816kb

input:

1000
0 10
20 30
40 50
60 70
80 90
100 110
120 130
140 150
160 170
180 190
200 210
220 230
240 250
260 270
280 290
300 310
320 330
340 350
360 370
380 390
400 410
420 430
440 450
460 470
480 490
500 510
520 530
540 550
560 570
580 590
600 610
620 630
640 650
660 670
680 690
700 710
720 730
740 750
76...

output:

1000
19986 19966 19946 19926 19906 19886 19866 19846 19826 19806 19786 19766 19746 19726 19706 19685 19666 19646 19626 19606 19586 19565 19546 19526 19506 19486 19466 19446 19426 19406 19386 19366 19346 19326 19306 19286 19266 19245 19226 19206 19186 19166 19146 19126 19106 19085 19066 19046 19025 1...

result:

ok 

Test #15:

score: 0
Accepted
time: 4ms
memory: 3820kb

input:

1000
0 33
33 66
66 99
99 132
132 165
165 198
198 231
231 264
264 297
297 330
330 363
363 396
396 429
429 462
462 495
495 528
528 561
561 594
594 627
627 660
660 693
693 726
726 759
759 792
792 825
825 858
858 891
891 924
924 957
957 990
990 1023
1023 1056
1056 1089
1089 1122
1122 1155
1155 1188
1188...

output:

913
32967 32934 32901 32868 32835 32769 32736 32703 32670 32637 32604 32571 32538 32505 32472 32439 32406 32373 32340 32307 32274 32208 32175 32142 32109 32076 32043 31977 31944 31878 31845 31812 31779 31746 31713 31680 31647 31614 31581 31548 31515 31482 31449 31416 31383 31350 31284 31251 31218 31...

result:

ok 

Test #16:

score: 0
Accepted
time: 2ms
memory: 3868kb

input:

1000
0 33
33 66
66 99
99 132
132 165
165 198
198 231
231 264
264 297
297 330
330 363
363 396
396 429
429 462
462 495
495 528
528 561
561 594
594 627
627 660
660 693
693 726
726 759
759 792
792 825
825 858
858 891
891 924
924 957
957 990
990 1023
1023 1056
1056 1089
1089 1122
1122 1155
1155 1188
1188...

output:

688
32967 32934 32901 32736 32703 32505 32439 32406 32340 32307 32274 32175 32142 32109 32076 32043 31944 31911 31779 31713 31680 31449 31350 31284 31251 31053 30954 30921 30723 30624 30591 30558 30492 30426 30393 30360 30261 30228 30096 29964 29931 29436 29304 29238 29106 29040 29007 28974 28941 28...

result:

ok 

Test #17:

score: 0
Accepted
time: 4ms
memory: 3876kb

input:

1000
0 33
33 66
66 99
99 132
132 165
165 198
198 231
231 264
264 297
297 330
330 363
363 396
396 429
429 462
462 495
495 528
528 561
561 594
594 627
627 660
660 693
693 726
726 759
759 792
792 825
825 858
858 891
891 924
924 957
957 990
990 1023
1023 1056
1056 1089
1089 1122
1122 1155
1155 1188
1188...

output:

614
32967 32868 32604 32538 32472 32439 32406 32373 32307 32208 32109 32076 31944 31878 31812 31647 31515 31482 31449 31251 31218 31185 31086 31053 30921 30756 30624 30525 30492 30195 29997 29700 29436 29337 29238 29106 29040 28908 28842 28611 28545 28413 28380 28215 28116 27984 27951 27918 27885 27...

result:

ok 

Test #18:

score: 0
Accepted
time: 2ms
memory: 3956kb

input:

1000
0 33
33 66
66 99
99 132
132 165
165 198
198 231
231 264
264 297
297 330
330 363
363 396
396 429
429 462
462 495
495 528
528 561
561 594
594 627
627 660
660 693
693 726
726 759
759 792
792 825
825 858
858 891
891 924
924 957
957 990
990 1023
1023 1056
1056 1089
1089 1122
1122 1155
1155 1188
1188...

output:

415
32604 32010 31746 31680 31647 31416 31218 31053 30789 30723 30657 29634 29568 29304 28809 28446 28413 28248 28083 27456 26994 26631 26532 26136 25410 25377 25047 24288 24222 23793 23694 23397 23298 22803 22770 22407 22374 22341 22308 22011 21879 21714 21549 21450 21153 21087 20988 20724 19899 19...

result:

ok 

Test #19:

score: 0
Accepted
time: 4ms
memory: 3980kb

input:

1000
0 33
33 66
66 99
99 132
132 165
165 198
198 231
231 264
264 297
297 330
330 363
363 396
396 429
429 462
462 495
495 528
528 561
561 594
594 627
627 660
660 693
693 726
726 759
759 792
792 825
825 858
858 891
891 924
924 957
957 990
990 1023
1023 1056
1056 1089
1089 1122
1122 1155
1155 1188
1188...

output:

182
32934 30558 29205 28974 27753 27720 26136 25377 23232 20625 20295 19668 19569 18810 17424 15279 14751 13266 12804 9306 8613 8448 7986 7161 4884 3069 2079 396 165 32885 32720 32291 32290 32126 31928 31730 31565 30938 30773 30707 30706 30641 30542 30278 29783 29321 29320 29057 28925 28562 28331 28...

result:

ok 

Test #20:

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

input:

10
0 897295
897295 1185774
1185774 1234783
1234783 2032897
2032897 2992228
2992228 3861506
3861506 4515440
4515440 4530303
4530303 4960434
4960434 5039539
10
897295 1191004 1218782 2026187 2032897 3409148 3817647 4410915 4515440 4522602

output:

6
4960434 4999987 4745369 2512563 1041535 448648 

result:

ok 

Test #21:

score: 0
Accepted
time: 0ms
memory: 3532kb

input:

5
2 15
15 25
25 40
42 52
52 62
3
5 29 52

output:

4
25 15 58 48 

result:

ok 

Test #22:

score: 0
Accepted
time: 1ms
memory: 3520kb

input:

100
0 41275
41275 358342
358342 716632
716632 762394
762394 1021131
1021131 1425233
1425233 1844446
1844446 2502361
2502361 3130148
3130148 3984772
3984772 4413739
4413739 4634425
4634425 4772966
4772966 5289086
5289086 5997849
5997849 6276152
6276152 7056556
7056556 7275248
7275248 7373865
7373865 ...

output:

37
41492031 34648611 31516382 27495496 24514909 19297439 19002662 18497410 14734797 9593949 1021131 41275 46320428 45036402 45036401 42578359 40303304 36751519 33217912 31386523 28240994 26505035 25676605 23396998 20205775 16682835 13304168 10646849 10646848 7799903 7537692 5643468 5031027 4199256 4...

result:

ok 

Test #23:

score: 0
Accepted
time: 4ms
memory: 3816kb

input:

1000
0 304786
304786 1286505
1286505 1602298
1602298 1889356
1889356 2427543
2427543 3041205
3041205 3293335
3293335 3683972
3683972 4455853
4455853 5009532
5009532 5138657
5138657 5264375
5264375 5443816
5443816 5978077
5978077 6706267
6706267 6766803
6766803 7317810
7317810 7745466
7745466 7951246...

output:

400
499382438 493807508 485976256 483851707 482775574 477445118 476791853 472125033 470245186 466281671 466135008 464517567 463515640 462359859 460697825 458588107 453905820 450890006 449942101 447067665 442643655 430490592 422499470 422115181 421860455 414663818 398851511 386625509 382753377 376513...

result:

ok 

Test #24:

score: 0
Accepted
time: 4ms
memory: 3816kb

input:

1000
0 668627
668627 1493991
1493991 1955432
1955432 2462090
2462090 3348370
3348370 3649888
3649888 4232217
4232217 4920841
4920841 5154187
5154187 5824420
5824420 6496201
6496201 6692463
6692463 7679806
7679806 8184427
8184427 9056696
9056696 9415570
9415570 10371466
10371466 11055208
11055208 120...

output:

404
488118961 477929789 475804021 472998219 471978773 471741217 470829139 469484614 468180562 467083164 459758898 448525995 448151446 438424526 434894274 434312520 428786950 414281132 405900357 404731563 404405209 402628711 398409595 396458736 386442161 383451688 378811821 377239229 375846382 375805...

result:

ok 

Test #25:

score: 0
Accepted
time: 4ms
memory: 3976kb

input:

1000
0 729025
729025 1403003
1403003 1430577
1430577 1655007
1655007 2318039
2318039 3152162
3152162 3612408
3612408 3698378
3698378 3847122
3847122 4099203
4099203 4394638
4394638 4535183
4535183 4679224
4679224 4924266
4924266 5809106
5809106 6092706
6092706 6512636
6512636 7182863
7182863 7889942...

output:

309
496344489 490363431 486409948 481777679 477881918 472479595 469612089 467166947 466102166 462212228 461601234 453290619 452714715 450080794 448094679 441257592 439812217 438939935 436354839 435112645 430699753 428969385 426525673 423949864 421088818 415568159 410242764 406397940 405632160 402884...

result:

ok 

Test #26:

score: 0
Accepted
time: 4ms
memory: 3924kb

input:

1000
0 551688
551688 698391
698391 698615
698615 1524420
1524420 1823936
1823936 2477838
2477838 2648920
2648920 3634817
3634817 3954585
3954585 4387372
4387372 4749036
4749036 5696471
5696471 5917145
5917145 6471607
6471607 7138159
7138159 8064119
8064119 8853507
8853507 9794300
9794300 10024230
10...

output:

47
514522806 489076668 485716688 468381598 465280213 458110577 451668915 429057687 418763874 415021408 406289225 385393739 363598407 357689578 356467305 346033233 341174006 320756313 299790418 284500334 278857206 268223051 256208664 240236008 239323938 237478124 234945138 224376794 214073814 1946578...

result:

ok 

Test #27:

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

input:

1000
0 737798
737798 1692350
1692350 2375226
2375226 2910782
2910782 3102289
3102289 3905018
3905018 4281758
4281758 4632993
4632993 5380689
5380689 6270471
6270471 6477095
6477095 6956831
6956831 7035284
7035284 7484603
7484603 7625533
7625533 8474133
8474133 8475172
8475172 8952662
8952662 9482058...

output:

0


result:

ok 

Test #28:

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

input:

1000
0 10
10 20
20 30
30 40
40 50
50 60
60 70
70 80
80 90
90 100
100 110
110 120
120 130
130 140
140 150
150 160
160 170
170 180
180 190
190 200
200 210
210 220
220 230
230 240
240 250
250 260
260 270
270 280
280 290
290 300
300 310
310 320
320 330
330 340
340 350
350 360
360 370
370 380
380 390
390...

output:

1001
19990 19980 19970 19960 19950 19940 19930 19920 19910 19900 19890 19880 19870 19860 19850 19840 19830 19820 19810 19800 19790 19780 19770 19760 19750 19740 19730 19720 19710 19700 19690 19680 19670 19660 19650 19640 19630 19620 19610 19600 19590 19580 19570 19560 19550 19540 19530 19520 19510 1...

result:

ok 

Test #29:

score: 0
Accepted
time: 4ms
memory: 3816kb

input:

1000
0 999000
999000 1998000
1998000 2997000
2997000 3996000
3996000 4995000
4995000 5994000
5994000 6993000
6993000 7992000
7992000 8991000
8991000 9990000
9990000 10989000
10989000 11988000
11988000 12987000
12987000 13986000
13986000 14985000
14985000 15984000
15984000 16983000
16983000 17982000
...

output:

1001
994005040 993006040 992007040 991008040 990009040 989010040 988011040 987012040 986013040 985014040 984015040 983016040 982017040 981018040 980019040 979020040 978021040 977022040 976023040 975024040 974025040 973026040 972027040 971028040 970029040 969030040 968031040 967032040 966033040 96503...

result:

ok 

Test #30:

score: 0
Accepted
time: 4ms
memory: 3740kb

input:

1000
0 999000
999000 1998000
1998000 2997000
2997000 3996000
3996000 4995000
4995000 5994000
5994000 6993000
6993000 7992000
7992000 8991000
8991000 9990000
9990000 10989000
10989000 11988000
11988000 12987000
12987000 13986000
13986000 14985000
14985000 15984000
15984000 16983000
16983000 17982000
...

output:

1001
994005040 993006040 992007040 991008040 990009040 989010040 988011040 987012040 986013040 985014040 984015040 983016040 982017040 981018040 980019040 979020040 978021040 977022040 976023040 975024040 974025040 973026040 972027040 971028040 970029040 969030040 968031040 967032040 966033040 96503...

result:

ok 

Test #31:

score: 0
Accepted
time: 4ms
memory: 3924kb

input:

963
278 373
558 1124
1816 3746
4646 5751
7119 7749
8001 8531
10824 10916
11489 11614
11778 12015
12413 13786
14482 15328
15554 15901
16704 17819
18297 18517
18623 18923
18934 19443
20309 20465
20906 21053
21360 21524
23313 23360
23372 23649
23654 23693
24766 25747
25795 26469
26587 27322
27429 27798...

output:

impossible

result:

ok 

Test #32:

score: 0
Accepted
time: 1ms
memory: 3576kb

input:

3
0 60
60 120
120 140
4
20 60 80 120

output:

impossible

result:

ok 

Test #33:

score: 0
Accepted
time: 2ms
memory: 3780kb

input:

1000
0 999000
999000 1998000
1998000 2997000
2997000 3996000
3996000 4995000
4995000 5994000
5994000 6993000
6993000 7992000
7992000 8991000
8991000 9990000
9990000 10989000
10989000 11988000
11988000 12987000
12987000 13986000
13986000 14985000
14985000 15984000
15984000 16983000
16983000 17982000
...

output:

1001
994005040 993006040 992007040 991008040 990009040 989010040 988011040 987012040 986013040 985014040 984015040 983016040 982017040 981018040 980019040 979020040 978021040 977022040 976023040 975024040 974025040 973026040 972027040 971028040 970029040 969030040 968031040 967032040 966033040 96503...

result:

ok 

Test #34:

score: 0
Accepted
time: 4ms
memory: 3740kb

input:

1000
0 999000
999000 1998000
1998000 2997000
2997000 3996000
3996000 4995000
4995000 5994000
5994000 6993000
6993000 7992000
7992000 8991000
8991000 9990000
9990000 10989000
10989000 11988000
11988000 12987000
12987000 13986000
13986000 14985000
14985000 15984000
15984000 16983000
16983000 17982000
...

output:

impossible

result:

ok 

Test #35:

score: 0
Accepted
time: 4ms
memory: 3812kb

input:

1000
0 999000
999000 1998000
1998000 2997000
2997000 3996000
3996000 4995000
4995000 5994000
5994000 6993000
6993000 7992000
7992000 8991000
8991000 9990000
9990000 10989000
10989000 11988000
11988000 12987000
12987000 13986000
13986000 14985000
14985000 15984000
15984000 16983000
16983000 17982000
...

output:

1001
994005040 993006040 992007040 991008040 990009040 989010040 988011040 987012040 986013040 985014040 984015040 983016040 982017040 981018040 980019040 979020040 978021040 977022040 976023040 975024040 974025040 973026040 972027040 971028040 970029040 969030040 968031040 967032040 966033040 96503...

result:

ok 

Test #36:

score: 0
Accepted
time: 1ms
memory: 3808kb

input:

1000
0 999000
999000 1998000
1998000 2997000
2997000 3996000
3996000 4995000
4995000 5994000
5994000 6993000
6993000 7992000
7992000 8991000
8991000 9990000
9990000 10989000
10989000 11988000
11988000 12987000
12987000 13986000
13986000 14985000
14985000 15984000
15984000 16983000
16983000 17982000
...

output:

1001
994005040 993006040 992007040 991008040 990009040 989010040 988011040 987012040 986013040 985014040 984015040 983016040 982017040 981018040 980019040 979020040 978021040 977022040 976023040 975024040 974025040 973026040 972027040 971028040 970029040 969030040 968031040 967032040 966033040 96503...

result:

ok 

Test #37:

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

input:

1000
200 626
986 1415
1499 1525
1545 1631
1778 2124
2269 2347
2541 3428
4010 4152
4202 4383
4589 4695
4754 4947
4961 5674
5760 5778
5907 6513
7229 7460
7496 7632
8001 8390
8580 8643
8880 8944
9028 9231
9912 9995
10233 10368
10421 10477
10508 11192
11518 11821
12271 12302
12696 14543
14552 15289
1557...

output:

2000
499750 499749 499569 499568 499187 499186 498319 498318 498077 498076 497452 497451 497193 497192 496814 496813 496509 496508 496362 496361 495512 495511 494604 494603 494209 494208 493719 493718 492689 492688 491779 491778 491141 491140 490248 490247 489813 489812 489093 489092 488662 488661 4...

result:

ok 

Test #38:

score: 0
Accepted
time: 3ms
memory: 3752kb

input:

1000
17 97
142 227
413 2466
2862 3208
3853 4194
5001 5286
5809 7448
7971 8576
8775 9174
9288 9593
9724 9774
10880 11010
11770 12970
13192 13240
13486 14498
14531 14890
15025 15937
16142 16612
16759 16792
17143 17155
17364 17620
17685 18038
18382 19725
19873 19883
19989 20990
21024 21288
21318 21328
...

output:

1801
916017 893740 893739 893201 893200 892953 892952 892369 892368 891406 891405 890674 890673 890457 890456 889631 889630 889076 889075 888913 888912 888335 888334 887804 887803 887366 887365 884956 884955 884695 884694 884371 884370 883211 883210 881095 881094 880809 880808 879712 879711 877547 8...

result:

ok 

Test #39:

score: 0
Accepted
time: 4ms
memory: 3940kb

input:

1000
500191 500310
500340 500524
500567 501061
501677 501687
501718 502130
502475 502623
502722 502894
502921 503453
503475 503509
503630 503647
504072 504906
505359 505435
505559 506024
506167 506397
507248 507376
507776 508667
508723 508996
509601 509904
510124 510252
510740 511076
511165 511513
5...

output:

2000
999588 999587 998800 998799 998489 998488 998413 998412 998050 998049 997693 997692 997016 997015 995920 995919 995708 995707 995359 995358 995150 995149 994683 994682 994232 994231 993791 993790 992656 992655 992437 992436 991805 991804 991389 991388 991089 991088 990871 990870 990047 990046 9...

result:

ok 

Test #40:

score: 0
Accepted
time: 1ms
memory: 3752kb

input:

1000
2147 2551
2606 2664
3757 5547
7714 8439
8799 9596
9951 10144
10241 10420
10672 10682
10721 11109
11189 11887
14469 14777
15853 16655
16894 17178
17371 19016
19354 19832
20990 21404
21495 21535
21887 23158
23884 23900
24488 25562
25643 26249
26324 26506
27320 27450
28236 28261
28377 28396
28516 ...

output:

1801
999944 999943 999816 999815 998561 998560 996966 996965 995977 995976 994857 994856 993372 993371 991727 991726 991026 991025 990560 990559 990252 990251 989056 989055 987631 987630 986785 986784 986009 986008 985290 985289 984520 984519 983624 983623 983225 983224 982852 982851 982509 982508 9...

result:

ok 

Test #41:

score: 0
Accepted
time: 4ms
memory: 3924kb

input:

1000
0 10
10 20
20 30
30 40
40 50
50 60
60 70
70 80
80 90
90 100
100 110
110 120
120 130
130 140
140 150
150 160
160 170
170 180
180 190
190 200
200 210
210 220
220 230
230 240
240 250
250 260
260 270
270 280
280 290
290 300
300 310
310 320
320 330
330 340
340 350
350 360
360 370
370 380
380 390
390...

output:

666
999999990 999999960 999999930 999999900 999999870 999999840 999999810 999999780 999999750 999999720 999999690 999999660 999999630 999999600 999999570 999999540 999999510 999999480 999999450 999999420 999999390 999999360 999999330 999999300 999999270 999999240 999999210 999999180 999999150 999999...

result:

ok