QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#764831#9709. Interesting gamepropaneAC ✓338ms34880kbC++201.5kb2024-11-20 10:52:252024-11-20 10:52:42

Judging History

This is the latest submission verdict.

  • [2024-11-20 10:52:42]
  • Judged
  • Verdict: AC
  • Time: 338ms
  • Memory: 34880kb
  • [2024-11-20 10:52:25]
  • Submitted

answer

#include<iostream>
#include<cstring>
#include<vector>
#include<set>
#include<algorithm>
using namespace std;
using LL = long long;

int main(){

#ifdef LOCAL
    freopen("data.in", "r", stdin);
    freopen("data.out", "w", stdout);
#endif

    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(0);

    int n;
    cin >> n;
    vector<int> ans(n - 1);
    vector<pair<int, int > > p(n);
    for(int i = 0; i < n; i++){
        cin >> p[i].first >> p[i].second;
    }
    sort(p.begin(), p.end(), [&](pair<int, int> a, pair<int, int> b){
        if (a.first != b.first) return a.first < b.first;
        return a.second > b.second;
    });

    set<pair<int, int> > sa, sb;

    auto get = [&](){
        int ans = -2e9;
        {
            int t = prev(sa.end())->first;
            if (prev(sa.end())->second == prev(sb.end())->second){
                t -= prev(sb.end(), 2)->first;
            }
            else{
                t -= prev(sb.end())->first;
            }
            ans = max(ans, t);
        }
        {
            int t = p[prev(sb.end())->second].first;
            t -= prev(sb.end(), 2)->first;
            ans = max(ans, t);
        }
        return ans;
    };

    sa.insert({p[0].first, 0});
    sb.insert({p[0].second, 0});
    for(int i = 1; i < n; i++){
        sa.insert({p[i].first, i});
        sb.insert({p[i].second, i});
        ans[n - 1 - i] = get();
    }
    for(int i = 1; i <= n - 2; i++) ans[i] = min(ans[i], ans[i - 1]);
    for(auto x : ans) cout << x << '\n';    

}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3628kb

input:

30
116128843 982073196
696441178 215582727
707098202 540372557
9994290 762832593
214276477 378578521
825342554 535912401
963793279 728234881
739665556 535050114
493246910 100938094
407622777 244255062
485368746 786450936
474928372 81143857
475273545 817746352
578248900 442993900
473402806 637374039
...

output:

-18279917
-40366050
-48946275
-95711300
-156730642
-159146094
-242407640
-274974994
-285632018
-403824296
-407009655
-488826286
-496704450
-506799651
-507144824
-508670390
-530117547
-547873015
-552591349
-563550670
-574450419
-608763081
-652831635
-652831635
-652831635
-652831635
-652831635
-652831...

result:

ok 29 numbers

Test #2:

score: 0
Accepted
time: 27ms
memory: 7792kb

input:

43858
209 616
768 131
666 811
914 10
451 163
583 756
97 849
656 209
854 661
280 391
87 592
47 973
111 235
401 361
306 590
124 883
155 498
637 711
910 319
676 423
486 551
987 743
152 353
43 23
686 871
734 581
446 272
678 992
601 7
429 654
516 850
299 599
74 692
812 687
271 971
911 672
87 634
688 902
...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
...

result:

ok 43857 numbers

Test #3:

score: 0
Accepted
time: 328ms
memory: 34732kb

input:

300000
158260522 877914575
602436426 24979445
861648772 623690081
433933447 476190629
262703497 211047202
971407775 628894325
731963982 822804784
450968417 430302156
982631932 161735902
880895728 923078537
707723857 189330739
910286918 802329211
404539679 303238506
317063340 492686568
773361868 1256...

output:

990
955
-3712
-5165
-5321
-5691
-9960
-17636
-18106
-20016
-24979
-29259
-34728
-36452
-50151
-53134
-64171
-64396
-64447
-70407
-71925
-80523
-81468
-82039
-82131
-91046
-91048
-91426
-94825
-97881
-100707
-103464
-105412
-105646
-105705
-106996
-115908
-122313
-122330
-123582
-125282
-127083
-1301...

result:

ok 299999 numbers

Test #4:

score: 0
Accepted
time: 134ms
memory: 18776kb

input:

146843
9496 6893
2372 2871
4932 3523
5464 8240
5559 9166
938 4124
5501 2158
6194 6035
7001 534
5871 4916
5139 2623
7631 7505
6261 2083
9800 8110
6573 6194
4258 3814
5551 9232
5931 1414
6288 1749
3089 4768
2860 1612
7083 9866
3360 9204
6001 2684
1104 2738
3743 2102
7315 4141
4902 8503
5202 4177
5483 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-2
-3
-3
-3
-3
-3
-3
-3
-3
-3
-3
-3
-3
-3
-3
-4
-4
-4
-4
-4
-4
-4
-4
-4
-5
-5
-5
-5
-5
-5
-5
-5
-5
-5
-5
-6
-6
-6
-6
-6
-6
-6
-6
-6
-6
-6
-6
-6
-6
-6
-6
-6
-7...

result:

ok 146842 numbers

Test #5:

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

input:

8
316491234 746170462
353659961 824032454
476111507 334288361
698265946 921174773
138030550 895168298
856554723 838590381
998797028 229577884
52406519 545268066

output:

77622255
-64620050
-196902352
-419056791
-541508337
-578677064
-578677064

result:

ok 7 numbers

Test #6:

score: 0
Accepted
time: 328ms
memory: 34832kb

input:

300000
928709127 710364850
501270008 433861154
995648492 596392093
118776745 384782478
349655296 539537581
111115036 650357104
5969178 689308608
898097118 47509232
858126628 57846250
363246037 585709995
476565403 19371760
794602423 547194673
223507217 851912910
812216720 736633480
408072364 84191851...

output:

90
-317
-7769
-11271
-14490
-16336
-20499
-22556
-25330
-33120
-33160
-33905
-39084
-42051
-44870
-55262
-56026
-61538
-61795
-64333
-65980
-67676
-67701
-70239
-74527
-75237
-81373
-83170
-90399
-92082
-100211
-100770
-105498
-106773
-107646
-109119
-109653
-111419
-117160
-118650
-130181
-139529
-...

result:

ok 299999 numbers

Test #7:

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

input:

2871
305 564
675 207
775 125
586 989
577 675
22 851
989 593
418 839
679 999
321 322
595 192
446 409
215 868
618 423
590 239
361 89
582 408
237 352
35 99
746 531
242 303
288 618
782 729
973 628
111 456
896 354
494 694
15 554
443 365
466 717
151 960
853 160
322 101
666 263
582 698
621 526
754 653
446 ...

output:

0
-1
-2
-2
-3
-3
-4
-5
-5
-5
-5
-7
-8
-8
-8
-9
-9
-9
-11
-11
-11
-12
-12
-12
-12
-12
-12
-13
-13
-13
-14
-14
-14
-14
-15
-15
-15
-16
-17
-17
-17
-17
-18
-18
-18
-18
-19
-19
-19
-20
-20
-20
-21
-21
-22
-22
-22
-22
-23
-24
-24
-25
-26
-26
-26
-27
-27
-27
-30
-31
-31
-31
-31
-32
-32
-33
-33
-34
-34
-34...

result:

ok 2870 numbers

Test #8:

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

input:

895
6859 1771
6490 4764
7027 8937
6936 6902
9054 8189
9407 2606
8223 3876
541 3369
1115 7339
2831 3359
2763 4357
2939 8685
9197 3625
2087 5028
9540 226
2127 3160
7380 317
8739 5377
8406 2318
1734 8077
3738 3851
2320 9260
112 1647
5949 2099
9246 6921
8077 8794
4397 2394
3986 8398
1116 4235
404 8223
6...

output:

-2
-26
-46
-86
-87
-87
-109
-113
-136
-149
-165
-165
-166
-168
-177
-194
-239
-241
-247
-250
-272
-278
-287
-289
-324
-343
-359
-373
-376
-391
-396
-401
-409
-442
-453
-456
-530
-538
-540
-561
-565
-567
-570
-585
-589
-614
-628
-637
-640
-644
-663
-671
-674
-685
-686
-692
-708
-709
-710
-736
-741
-7...

result:

ok 894 numbers

Test #9:

score: 0
Accepted
time: 326ms
memory: 34684kb

input:

300000
202020954 498992274
752814698 244273692
305609064 129707894
494125617 739407332
506884908 61912693
980615582 290527608
924052028 605760302
850344193 866095040
490087489 797037171
986773246 215594009
72183418 251798218
770819853 163753684
66204216 697009391
729631737 733504437
706216800 214579...

output:

-743
-2203
-3465
-4833
-5717
-10382
-13288
-18266
-18567
-23802
-27773
-29401
-31753
-32630
-33288
-33960
-36880
-38573
-39571
-41440
-43315
-44767
-60540
-62884
-65893
-68230
-69261
-69589
-70810
-75690
-76638
-78986
-80342
-98162
-99405
-101516
-106561
-119644
-134816
-136433
-148060
-148358
-1518...

result:

ok 299999 numbers

Test #10:

score: 0
Accepted
time: 77ms
memory: 13360kb

input:

96099
884410 199869
378999 484351
42962 2002
228501 78151
378793 81203
499367 912218
229999 631145
556345 787305
429353 984689
797990 77277
538348 92732
652897 628750
824678 466542
70192 371853
779286 278560
719339 253787
751375 397471
258306 239920
242041 426218
375541 570293
437520 302263
915097 3...

output:

-28
-30
-38
-39
-67
-79
-85
-105
-113
-119
-132
-146
-155
-161
-164
-165
-184
-185
-197
-222
-247
-259
-265
-297
-298
-308
-310
-323
-331
-386
-402
-406
-415
-422
-427
-436
-458
-466
-497
-499
-515
-528
-536
-560
-577
-584
-587
-588
-590
-593
-600
-604
-626
-630
-663
-664
-671
-675
-694
-702
-712
-7...

result:

ok 96098 numbers

Test #11:

score: 0
Accepted
time: 107ms
memory: 17436kb

input:

135081
53066 69643
18435 39695
18951 69305
52629 41547
82564 4387
9491 26888
991 9888
40627 68164
33253 25047
18943 12275
39291 40516
61620 91834
1081 96954
82404 41141
12715 84411
71508 2577
32334 86530
93151 95218
72793 7673
92369 95503
36465 56771
17004 28081
98611 80435
14695 9816
22318 26067
47...

output:

0
0
-2
-2
-2
-3
-4
-6
-6
-6
-7
-7
-8
-9
-9
-9
-12
-12
-13
-13
-14
-15
-15
-16
-16
-19
-19
-20
-21
-22
-22
-23
-23
-23
-24
-25
-25
-25
-25
-26
-26
-26
-28
-29
-29
-29
-29
-30
-30
-32
-33
-33
-33
-33
-33
-33
-34
-35
-35
-35
-37
-37
-38
-39
-40
-41
-42
-43
-43
-43
-44
-45
-45
-47
-47
-48
-48
-49
-50
-5...

result:

ok 135080 numbers

Test #12:

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

input:

5
2 2
3 2
4 4
5 6
6 6

output:

0
0
0
0

result:

ok 4 number(s): "0 0 0 0"

Test #13:

score: 0
Accepted
time: 177ms
memory: 22388kb

input:

181051
540044 278759
126308 835287
197134 171207
765075 480379
652710 496015
76113 771467
121520 254524
87971 667263
516990 362143
590916 129122
654933 930847
705252 3668
982060 368694
930916 521736
701297 749296
85659 56326
232579 613167
224212 622826
274616 8041
954702 608547
351833 281192
267963 ...

output:

-4
-8
-16
-29
-30
-31
-34
-44
-47
-50
-51
-51
-55
-63
-68
-79
-83
-84
-84
-98
-105
-124
-127
-128
-129
-151
-158
-160
-170
-173
-176
-181
-182
-185
-193
-200
-206
-212
-227
-236
-252
-253
-258
-264
-268
-273
-274
-304
-314
-315
-340
-344
-348
-349
-350
-355
-359
-364
-373
-374
-381
-397
-403
-404
-4...

result:

ok 181050 numbers

Test #14:

score: 0
Accepted
time: 63ms
memory: 11892kb

input:

81456
3315744 1405920
7918039 5789147
4847407 1555877
47476 5867758
5264316 6158146
6247262 5686175
5537060 6918727
8622783 8679128
1504251 6820633
378291 2521877
3720966 4291310
3370954 9178986
6776768 9843665
8488457 3613819
7386457 103076
7592169 297602
4595250 5042585
7574743 5746765
4265314 457...

output:

-74
-143
-150
-319
-441
-514
-578
-590
-618
-639
-645
-702
-790
-1406
-1457
-1818
-1923
-1954
-2173
-2226
-2346
-2592
-2634
-2641
-2685
-2736
-2944
-3426
-3464
-3502
-3672
-4073
-4156
-4381
-4460
-4846
-4848
-5183
-5244
-5736
-5739
-6116
-6157
-6425
-6499
-6684
-6736
-6845
-6856
-6871
-6913
-7025
-7...

result:

ok 81455 numbers

Test #15:

score: 0
Accepted
time: 31ms
memory: 9452kb

input:

58990
527 768
764 98
634 878
190 381
233 289
379 456
630 314
148 982
157 600
98 302
294 331
334 180
198 594
439 280
838 310
343 261
107 53
830 851
173 808
278 974
16 189
581 902
733 245
462 293
754 727
80 76
590 828
613 86
678 425
237 282
659 536
880 741
842 703
920 806
490 15
485 865
593 846
94 565...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-2
-2
-...

result:

ok 58989 numbers

Test #16:

score: 0
Accepted
time: 326ms
memory: 34716kb

input:

300000
431686690 823333231
844144802 245119971
985532409 902623724
307666461 853039527
573445645 876984955
451516709 35707533
152543155 367943032
250120393 113988157
605335380 582184056
396111469 803077333
736435438 29406401
827868744 826974051
331244692 608652749
736674279 520525422
844591337 37627...

output:

-3749
-4255
-4451
-10027
-22706
-28929
-29827
-30242
-40103
-42541
-45333
-47492
-49118
-53828
-57760
-59264
-60195
-63640
-71365
-74381
-85956
-87205
-89318
-89996
-90403
-92944
-95394
-97216
-98463
-100654
-107410
-108119
-109097
-109117
-111595
-112380
-118582
-121562
-125106
-125933
-127522
-128...

result:

ok 299999 numbers

Test #17:

score: 0
Accepted
time: 328ms
memory: 34804kb

input:

300000
677683550 741166409
73295519 813718902
78028703 720207871
834594670 240741335
989288355 211268797
314456497 634861231
841807230 590111392
307392310 805826664
565163611 136633339
370562080 66927069
199415031 557243093
583848296 200646368
961773092 53568360
638006106 287811253
904001864 4384272...

output:

1576
-415
-1077
-5646
-10894
-12323
-16815
-20740
-25366
-29380
-30325
-34746
-44018
-47230
-50812
-51799
-54772
-55774
-56422
-64871
-65700
-77067
-80300
-83013
-83266
-86253
-87378
-87523
-91230
-94776
-101194
-102960
-104150
-108783
-112559
-113419
-115075
-116926
-122053
-124930
-127233
-129408
...

result:

ok 299999 numbers

Test #18:

score: 0
Accepted
time: 6ms
memory: 4728kb

input:

10979
7564290 551434
9602935 9486426
2957497 2408050
9192341 5337092
1272162 2586129
5832021 1139158
220563 2565765
2785415 1890744
705141 7236258
5646159 1034631
2879559 3651693
359205 8633875
9158745 6934434
5910867 6576290
3039122 1080879
1488507 2792044
9776235 3643190
3867279 8973084
9764594 30...

output:

-1946
-3673
-5900
-6801
-6868
-7191
-7772
-7822
-8816
-9197
-9257
-9903
-9971
-10566
-12635
-14779
-15398
-18194
-18317
-18653
-19854
-20058
-22551
-22932
-23038
-25427
-25671
-27064
-29829
-30469
-31102
-31467
-32906
-33039
-33729
-33983
-34198
-34851
-35396
-35662
-37697
-38196
-38449
-38940
-3937...

result:

ok 10978 numbers

Test #19:

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

input:

4
3 8
4 2
2 1
1 2

output:

1
1
0

result:

ok 3 number(s): "1 1 0"

Test #20:

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

input:

16681
76356 87141
81040 88906
76130 10961
66049 99464
82540 70701
84306 5568
4903 27571
95732 1219
93455 11692
71339 75352
87729 5561
41648 58840
23569 46574
81999 53809
25414 4081
69738 90116
84441 8223
57971 96168
24650 91592
78582 30436
89611 12878
56461 12344
32835 37322
27946 19253
60684 3207
4...

output:

22
2
-3
-7
-17
-19
-29
-31
-33
-39
-40
-42
-44
-46
-53
-67
-69
-78
-80
-90
-117
-127
-139
-143
-146
-152
-178
-199
-203
-208
-211
-222
-230
-232
-234
-238
-241
-244
-244
-252
-263
-264
-265
-280
-288
-294
-297
-299
-301
-308
-314
-317
-342
-344
-350
-361
-365
-372
-375
-375
-381
-391
-392
-393
-396
...

result:

ok 16680 numbers

Test #21:

score: 0
Accepted
time: 323ms
memory: 34728kb

input:

300000
669941876 463692833
608768800 383483064
899916933 232501264
936281366 387363018
878833726 393998203
863778832 338015393
550869098 426925964
680252634 259721299
568149274 351343024
903521351 413322336
983772752 13361611
854874119 220023510
890885648 127338210
787442246 60606532
779387689 73005...

output:

499991853
499989212
499988980
499988887
499985901
499985744
499984751
499981700
499981363
499978895
499977751
499977646
499976898
499975783
499974333
499972677
499972591
499971043
499969587
499968387
499967498
499966842
499965501
499964490
499963398
499962164
499960623
499959214
499954400
499953506
...

result:

ok 299999 numbers

Test #22:

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

input:

8304
9268074 4558638
155883 2514564
4528437 8650842
3457375 3935189
7024003 133233
850228 4697107
1308848 980062
5512018 1652805
4458953 3779680
6713230 4655875
3942803 7399820
206520 2931581
8199042 4660554
7227918 7616626
1493315 2316627
11334 922042
5915058 5387449
394376 3238589
4978788 2460383
...

output:

591
576
-362
-2002
-2116
-2185
-2259
-2695
-5188
-5289
-6079
-7311
-8979
-9833
-10339
-12526
-14640
-14657
-18744
-21168
-21504
-21525
-22332
-22533
-22641
-23161
-23371
-24003
-25062
-29103
-29809
-30719
-30746
-31226
-31556
-32683
-33289
-33446
-33596
-35412
-35692
-39853
-45247
-45428
-45529
-488...

result:

ok 8303 numbers

Test #23:

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

input:

3
4 100
5 98
1 100

output:

-95
-96

result:

ok 2 number(s): "-95 -96"

Test #24:

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

input:

350
697 855
384 740
433 259
845 810
662 613
188 232
189 154
96 39
116 881
125 176
120 584
808 266
959 534
122 496
335 434
328 121
829 195
606 431
279 501
383 840
667 914
743 288
557 407
58 429
909 547
714 482
806 659
628 52
785 825
387 752
400 712
556 27
723 626
561 248
974 322
438 734
833 282
199 7...

output:

-7
-7
-9
-9
-11
-11
-21
-25
-30
-34
-40
-40
-45
-48
-50
-54
-54
-57
-58
-63
-75
-77
-79
-80
-82
-83
-90
-91
-91
-92
-103
-104
-109
-109
-110
-114
-125
-130
-133
-134
-141
-145
-154
-155
-157
-158
-160
-160
-162
-163
-166
-170
-170
-176
-178
-184
-187
-191
-191
-192
-192
-192
-193
-194
-201
-203
-205...

result:

ok 349 numbers

Test #25:

score: 0
Accepted
time: 325ms
memory: 34804kb

input:

300000
903502377 51200372
915583225 476708291
707749140 341462850
987857936 101231297
861171725 121782806
972427087 172932038
976840767 153208217
945670315 17349754
885014320 231054529
671560923 389698731
578353664 239803153
536430168 425261545
545754556 315577497
791893217 462252163
584927791 43590...

output:

499689148
499687153
499685793
499683448
499681782
499681396
499678540
499675441
499673686
499673209
499672626
499671890
499668141
499667627
499665721
499659751
499659525
499658639
499658470
499658218
499657584
499656773
499656585
499656364
499652098
499651707
499650262
499649286
499645215
499643027
...

result:

ok 299999 numbers

Test #26:

score: 0
Accepted
time: 6ms
memory: 5184kb

input:

15859
2040 8166
884 9209
3945 876
3878 3266
5548 2384
9009 1121
8660 8156
5281 6905
5366 8048
1846 7524
860 8223
5346 1613
1123 9646
6622 9462
2332 1464
2628 2963
3790 8412
3430 1245
1794 7501
8438 9217
2118 9745
5212 6398
9915 6435
9140 7835
4519 9218
9965 6878
8900 9919
4507 7749
1231 3715
6373 69...

output:

0
0
-4
-5
-6
-7
-8
-8
-9
-10
-10
-10
-10
-12
-14
-14
-14
-14
-15
-16
-16
-17
-18
-19
-20
-21
-21
-21
-21
-25
-25
-25
-26
-27
-27
-28
-31
-31
-32
-33
-34
-34
-35
-36
-36
-36
-38
-40
-40
-41
-42
-43
-44
-46
-48
-48
-49
-49
-49
-50
-51
-52
-52
-53
-54
-55
-55
-55
-56
-56
-58
-59
-59
-59
-60
-62
-63
-64...

result:

ok 15858 numbers

Test #27:

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

input:

269
23111 90820
92810 79934
16703 79080
63618 8683
12727 34681
24441 13502
75987 91317
73422 38270
16875 87565
55921 7589
32425 46630
6921 60258
99055 72662
9967 99032
56143 49709
66801 39805
36465 92457
99696 36220
58640 97504
45186 17043
733 64891
70097 12918
14459 8117
27993 29802
40289 28864
882...

output:

63
-42
-318
-683
-1192
-1215
-1304
-1639
-2518
-2518
-2583
-2778
-3287
-3622
-4016
-4062
-4993
-6077
-6111
-6565
-6928
-7015
-7479
-7818
-8021
-8464
-8656
-9597
-10236
-11376
-11468
-12447
-12472
-13176
-13406
-13472
-14888
-14889
-15346
-17127
-17590
-17672
-18534
-19975
-20486
-21063
-21359
-22392...

result:

ok 268 numbers

Test #28:

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

input:

381
7209 439
9441 4909
9509 755
9170 6418
8067 164
8728 7273
9334 8651
6829 4432
7360 2672
1825 3718
3195 6490
4437 142
8388 6408
9200 5520
4186 9147
5133 3080
1940 9529
5787 6613
296 6380
2364 7403
4661 9345
1126 7298
5754 8778
9973 2388
4396 7980
1447 7923
4900 8498
5806 6417
6367 6232
3634 7301
1...

output:

3
-20
-49
-57
-117
-134
-142
-207
-230
-231
-256
-290
-388
-410
-484
-522
-551
-552
-559
-562
-659
-676
-704
-772
-772
-779
-793
-804
-823
-842
-845
-850
-886
-1009
-1027
-1040
-1054
-1135
-1162
-1216
-1230
-1265
-1286
-1309
-1312
-1336
-1401
-1476
-1567
-1569
-1605
-1616
-1619
-1646
-1741
-1744
-17...

result:

ok 380 numbers

Test #29:

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

input:

278
41397108 7789945
39535515 48718508
57264575 25897329
51953356 64106312
33804972 71261667
60959486 45331193
38455557 98828378
13032674 92462403
52872197 70676979
83288289 52977789
98684382 65072864
28034196 83827284
81241909 30910950
35396169 7682886
27333281 92818655
67088005 58379816
74243631 5...

output:

-44828
-225020
-323222
-439108
-529790
-1227893
-1260568
-1433368
-1877611
-2170714
-2576223
-2634734
-3734169
-4844073
-5160479
-5539478
-5550265
-5752897
-5811800
-5962237
-6010971
-6043752
-6503722
-6693570
-7812519
-8490065
-8641928
-8728179
-8731750
-9182121
-9419159
-9745811
-9874486
-9925314
...

result:

ok 277 numbers

Test #30:

score: 0
Accepted
time: 317ms
memory: 34772kb

input:

300000
487702696 588323468
274853557 948500003
242361056 677063364
355000661 534748678
30060701 537514173
287011486 743471067
52616488 784929362
103335757 502066350
454921885 629249572
314052810 965050909
374598746 532042183
111819474 583918824
154430791 799575140
196731032 987782197
24542593 690429...

output:

-500155638
-500156062
-500159997
-500160221
-500164202
-500164483
-500166469
-500167445
-500173341
-500175955
-500177586
-500178062
-500178179
-500183167
-500184372
-500186297
-500187206
-500187477
-500189923
-500190055
-500190823
-500192387
-500192710
-500192926
-500193334
-500194725
-500196049
-50...

result:

ok 299999 numbers

Test #31:

score: 0
Accepted
time: 338ms
memory: 34732kb

input:

300000
636333017 135225607
938607432 245059097
560260339 11776101
574341040 294502515
823558046 475869210
539756724 192706765
582014620 128857412
866136995 47376695
663060184 358061812
574941926 87463887
654139713 347994104
551615867 403857456
681896451 468946621
552544423 320116951
930377332 181248...

output:

499494425
499494249
499490351
499489447
499488898
499488056
499486607
499486300
499485255
499484297
499482839
499481974
499479475
499478326
499477598
499476824
499476301
499476083
499473341
499472398
499471137
499466650
499465077
499462679
499462310
499461134
499459346
499458466
499458201
499454475
...

result:

ok 299999 numbers

Test #32:

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

input:

257
795968626 396820646
346736999 641983646
556456618 193882952
24836738 694735457
358877026 57529618
673293111 960936805
746545665 211338485
30351269 414092517
821321984 316811026
844545599 111619212
205558893 69851457
427168333 193873147
725327465 506117003
313564778 673446470
327566250 494077616
...

output:

-7320058
-8855240
-12182209
-17036509
-17191575
-18459217
-22813923
-30201465
-32057920
-33901918
-34141585
-38902136
-44877802
-45023021
-48848546
-49850964
-57737973
-63413905
-63862592
-66497868
-69524857
-78924073
-83639167
-90351240
-93119302
-99151474
-106837632
-107087056
-118828992
-12747867...

result:

ok 256 numbers

Test #33:

score: 0
Accepted
time: 337ms
memory: 34808kb

input:

300000
243895613 676288552
458319084 964305390
211139770 792277080
258500060 529540688
71701436 623413209
71254203 907108609
57437038 687848671
210568454 667645816
145913239 844201402
323390358 987462690
345833264 721007830
8668778 614106831
131000012 861110156
8282175 921312005
460013505 583144694
...

output:

-499747245
-499748321
-499749191
-499749733
-499754485
-499757852
-499759832
-499760973
-499762979
-499763563
-499764315
-499764403
-499766444
-499769940
-499774593
-499776893
-499778594
-499780297
-499780686
-499781211
-499784927
-499785484
-499787996
-499788691
-499790454
-499795204
-499795934
-49...

result:

ok 299999 numbers

Test #34:

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

input:

901
7513326 5669701
8052427 1588673
2536109 7141077
5620080 6930269
9149162 5877615
6924607 5396303
2220788 248999
4621633 558711
3584170 9931594
7819216 4097065
9623684 8008916
4659868 9798831
60554 6278522
866857 7430981
1101018 6908706
9931215 2294171
2005286 2222054
144697 2490455
4786100 273141...

output:

2047
-29531
-55487
-62123
-66618
-74523
-94538
-107699
-114513
-117019
-135658
-135824
-137326
-147624
-155786
-174206
-174500
-180274
-180345
-198358
-226128
-228133
-234680
-238504
-244950
-246951
-270275
-287765
-300551
-311126
-321575
-329888
-331233
-345005
-349428
-361087
-374149
-403469
-4391...

result:

ok 900 numbers

Test #35:

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

input:

6868
831038 143155
41925 65321
556131 812486
5787 92697
745955 833892
37814 725646
631785 204957
297724 249636
995442 677369
315108 74091
412113 680242
260024 81000
312041 166584
728985 141716
2934 49324
1595 622428
663812 539301
413156 570015
694326 244462
824818 713395
861249 66374
214802 36641
94...

output:

133
105
-5
-7
-604
-708
-710
-777
-915
-936
-1013
-1017
-1254
-1403
-1466
-1542
-1819
-1821
-2080
-2180
-2218
-2278
-2297
-2492
-2538
-2631
-2740
-3043
-3152
-3268
-3275
-3866
-4020
-4303
-4323
-4364
-4383
-4445
-4544
-4569
-4609
-5018
-5240
-5333
-5350
-5471
-5476
-5550
-5832
-5873
-5976
-6036
-606...

result:

ok 6867 numbers

Test #36:

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

input:

8404
58535 39799
32361 71268
53815 76640
5637 64526
6395 62260
81729 68874
44374 82549
4390 85301
70396 2906
75060 69244
23317 83339
46013 23076
7037 59686
51784 16229
94407 54237
29871 12970
3893 96406
99329 54738
53378 44457
12065 99186
52952 52742
98469 63441
87290 94540
10264 85483
67516 85235
4...

output:

15
5
-18
-20
-23
-47
-52
-72
-92
-106
-107
-110
-131
-133
-170
-177
-198
-223
-224
-227
-233
-233
-237
-237
-247
-248
-269
-289
-304
-306
-315
-329
-366
-378
-378
-403
-424
-477
-492
-495
-530
-535
-542
-547
-558
-562
-571
-581
-583
-597
-621
-634
-635
-645
-647
-653
-659
-690
-708
-714
-729
-750
-7...

result:

ok 8403 numbers

Test #37:

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

input:

507
246325 138
930403 754311
211232 40182
291182 320409
553238 388944
524643 990317
31316 747847
731532 819854
409421 63072
668069 607898
775527 47536
954654 499073
253503 558949
427741 548297
478369 548606
866425 864589
289360 789006
823744 753145
79172 789821
653618 330320
240167 208263
34627 2132...

output:

-3364
-5264
-7397
-12459
-13551
-15041
-23754
-24239
-25737
-25741
-25782
-27822
-29747
-29840
-30309
-31462
-32929
-34633
-34791
-35228
-45038
-48595
-49007
-51109
-62605
-64282
-68718
-69289
-69884
-70295
-71110
-72181
-77558
-78031
-78203
-78382
-78642
-80114
-81837
-82248
-84792
-84796
-88889
-9...

result:

ok 506 numbers

Test #38:

score: 0
Accepted
time: 327ms
memory: 34880kb

input:

300000
335631314 923798678
91296075 797197766
173333395 683482685
129338487 970679746
442527410 547984741
261417386 539691206
90686237 953784693
54608848 684586215
304013848 867109752
247152537 865800979
64169459 656661186
269612934 996012816
394338685 855216868
359872966 944705369
88767611 54816399...

output:

-500276805
-500277226
-500278976
-500279203
-500279650
-500279697
-500281060
-500281591
-500282144
-500287152
-500289858
-500290234
-500297575
-500300203
-500301737
-500302489
-500303125
-500304161
-500307219
-500310558
-500311666
-500312210
-500315711
-500317046
-500317178
-500317874
-500318642
-50...

result:

ok 299999 numbers