QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#55169#1347. Universal and Existential Quantifiersckiseki#WA 195ms23500kbC++1.5kb2022-10-12 16:26:062022-10-12 16:26:07

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-12 16:26:07]
  • 评测
  • 测评结果:WA
  • 用时:195ms
  • 内存:23500kb
  • [2022-10-12 16:26:06]
  • 提交

answer

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

template <typename T> using max_heap = priority_queue<T>;

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int N;
    int64_t C;
    cin >> N >> C;
    vector<pair<int64_t,int64_t>> segs(N);
    for (auto &[l, r]: segs) {
        cin >> l >> r;
    }
    sort(segs.begin(), segs.end());

    int ans1 = 0;
    int ans2 = 0;
    {
        int64_t curl = 0;
        int it = 0;
        max_heap<int64_t> pq;
        while (curl < C) {
            while (it < segs.size() && segs[it].first <= curl) {
                int64_t r = segs[it++].second;
                pq.emplace(r);
            }
            assert (pq.top() > curl);
            curl = pq.top();
            ++ans1;
            pq.pop();
        }
    }

    {
        vector<int64_t> L, R;
        vector<int64_t> u;
        for (auto [l, r]: segs) {
            L.emplace_back(r);
            R.emplace_back(l);
            if (l > 0)
                u.emplace_back(l - 1);
            u.emplace_back(l);
            u.emplace_back(r - 1);
            if (r < C)
                u.emplace_back(r);
        }
        sort(L.begin(), L.end());
        sort(R.begin(), R.end());

        for (int64_t x: u) {
            int le = lower_bound(L.begin(), L.end(), x) - L.begin();
            int ri = R.end() - upper_bound(R.begin(), R.end(), x);
            // cerr << le << '+' << ri << endl;
            ans2 = max(ans2, le + ri);
        }
    }
    ++ans2;
    cout << ans1 << ' ' << ans2 << '\n';
}

詳細信息

Test #1:

score: 100
Accepted
time: 3ms
memory: 3556kb

input:

3 3
0 2
1 3
1 2

output:

2 3

result:

ok 2 number(s): "2 3"

Test #2:

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

input:

2 4
0 4
0 4

output:

1 1

result:

ok 2 number(s): "1 1"

Test #3:

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

input:

5 4
0 2
2 4
0 3
1 3
3 4

output:

2 4

result:

ok 2 number(s): "2 4"

Test #4:

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

input:

72 6951
1279 5415
5774 5967
352 2975
4106 6269
565 3393
4119 5218
3154 4517
1323 4249
5468 6430
4356 6171
6461 6777
5997 6190
2895 6933
2072 5554
975 2873
3436 5916
6078 6377
6068 6569
4419 4775
4637 6656
1821 6617
2430 4645
4251 5125
2873 6894
5102 5914
785 2327
2853 6333
6091 6302
1477 6365
2015 4...

output:

3 72

result:

ok 2 number(s): "3 72"

Test #5:

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

input:

25 6007
2636 5976
4846 4848
2011 2320
4483 5650
4590 5525
5686 5983
4438 6007
3487 5407
5611 6005
5904 6006
4288 5436
3408 4233
2315 4762
5576 5660
3988 5327
956 5992
3368 5103
4448 5975
4629 4827
4557 5921
3696 6001
0 5196
2127 5131
4719 5451
793 5151

output:

2 25

result:

ok 2 number(s): "2 25"

Test #6:

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

input:

71 5875
3245 4539
2453 2646
5139 5424
4735 5233
0 5852
1073 1109
3220 4838
482 1667
4111 5874
1738 5508
1555 1757
5081 5369
2527 5054
321 4402
5183 5720
4395 4855
2774 5256
668 3284
4346 4564
2436 2932
1694 4462
1514 4716
2067 2165
5146 5349
869 4216
4850 5150
2636 5091
171 4352
1550 1830
4731 5286
...

output:

2 71

result:

ok 2 number(s): "2 71"

Test #7:

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

input:

72 3554
2007 2891
2321 3403
3423 3452
3513 3545
2651 2798
629 3542
3150 3310
2827 3181
550 3554
2884 3240
82 3553
1253 3467
66 1994
1871 2692
1730 2083
812 3547
863 1809
2622 2631
2883 3500
1543 2704
2225 3002
1057 2684
1562 3143
510 3532
1417 2880
3220 3337
2617 3222
2326 3092
2974 3124
509 3279
21...

output:

2 72

result:

ok 2 number(s): "2 72"

Test #8:

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

input:

12 2462
1212 2458
392 1970
710 1769
533 1677
1694 1742
2026 2462
0 1381
48 1400
1042 2460
1912 2330
293 2446
60 2293

output:

3 12

result:

ok 2 number(s): "3 12"

Test #9:

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

input:

11 8900
6913 8898
4203 8886
0 8147
5469 8883
7658 8900
8154 8876
3532 8701
4251 8869
7214 8843
8626 8899
3051 7676

output:

2 11

result:

ok 2 number(s): "2 11"

Test #10:

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

input:

54 8641
6433 7171
5844 5934
5405 7192
6544 6631
3012 5527
5374 6052
3439 6694
4120 4686
7324 8329
4422 8601
7053 8258
888 4474
972 1832
0 3047
3071 4758
5303 6898
7396 8394
5926 8602
3370 5206
1507 3332
7603 8141
3722 8387
4599 8637
292 5399
673 8640
2757 6991
68 1412
72 1074
4409 8210
4122 8039
161...

output:

3 54

result:

ok 2 number(s): "3 54"

Test #11:

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

input:

31 7482
1130 7210
4939 6328
0 66
28 89
1772 6450
3255 6386
1363 7482
5576 5931
1608 5509
4072 4513
1635 4691
5220 6904
5361 5915
5071 7474
5796 6472
1057 1989
20 1293
2983 5045
785 3917
4272 7470
2639 7473
2186 7468
1455 3299
373 1801
2715 6062
1972 5083
5290 6064
1288 1576
487 6403
4997 5897
3399 7...

output:

4 31

result:

ok 2 number(s): "4 31"

Test #12:

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

input:

28 4245
2269 4219
2856 4233
2548 4205
2111 4243
741 2578
1329 4072
683 1698
1891 4196
1483 2331
3900 4192
3508 3806
613 4185
1707 3159
2753 2871
159 4242
274 4099
4073 4221
1034 3444
2925 4202
3460 4103
0 1324
706 909
1 3535
1212 2696
3193 4006
23 2795
4000 4245
646 1821

output:

3 28

result:

ok 2 number(s): "3 28"

Test #13:

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

input:

19 7893
7205 7860
1081 4787
362 7778
3599 7892
7729 7730
5390 7773
2426 6594
2533 7893
2215 3878
6499 6516
0 2764
4026 7537
3343 5155
2188 6265
5912 7891
1186 7867
6187 7574
3020 4601
4025 6281

output:

2 19

result:

ok 2 number(s): "2 19"

Test #14:

score: 0
Accepted
time: 88ms
memory: 13456kb

input:

114343 999999779541
961721540565 976396960953
589941177726 866813045481
621153122593 897177242310
905375852958 980690474834
769887663789 993876779994
419220971814 575086803821
893226415014 977540565350
6316923158 888251545625
260132303809 670073868273
983608882908 986249588581
253618956906 312051265...

output:

3 114343

result:

ok 2 number(s): "3 114343"

Test #15:

score: 0
Accepted
time: 155ms
memory: 13460kb

input:

114696 999999248497
304084248466 394866293909
662209401853 826810816600
468842921373 883848636199
810536611764 883483160880
941855270718 984465500097
323876602159 752524035569
588016363851 745413226300
296945561679 932802537918
563404823459 836409553825
746182179600 887253382732
826471400903 9722708...

output:

3 114696

result:

ok 2 number(s): "3 114696"

Test #16:

score: 0
Accepted
time: 168ms
memory: 22552kb

input:

177836 999999870469
23534665826 489867815775
150000080390 988176630989
503276260048 829600836873
342576938472 373658942813
756704369085 966083515671
323311922882 752005192830
128586675089 661277198514
418993157840 598669211042
328288304246 577970651290
54237183482 809477168070
108531199507 751445421...

output:

3 177836

result:

ok 2 number(s): "3 177836"

Test #17:

score: 0
Accepted
time: 112ms
memory: 14712kb

input:

116188 999999161844
257334261947 292880632549
948789768188 999216207608
109948920728 746143652324
968081954176 984251936676
675355081783 859705677482
850426624682 911006445581
670821756401 830977975481
172879696478 476348601748
652946195584 761320548333
322371240027 405673331675
780743715314 8677547...

output:

3 116188

result:

ok 2 number(s): "3 116188"

Test #18:

score: 0
Accepted
time: 195ms
memory: 22328kb

input:

178705 999999614604
636586866727 705987923669
401913764451 660567007809
813783020379 861099118576
417181573786 593481515781
111466624195 601221303314
191006790702 520092271694
462385950631 999065119006
563502314585 613558290395
811372859453 971530236778
410523703829 771020221370
322821029234 8240313...

output:

3 178705

result:

ok 2 number(s): "3 178705"

Test #19:

score: 0
Accepted
time: 170ms
memory: 23440kb

input:

182323 999999477491
180321575960 222599363339
802117625127 823622213305
753679082691 774286562443
284784387906 541022286744
174958622782 562096595171
841963589382 991460662024
388661340109 974930839146
499464925799 508984713514
239827936858 476894966561
400100780368 629705811992
978907556773 9954113...

output:

3 182323

result:

ok 2 number(s): "3 182323"

Test #20:

score: 0
Accepted
time: 172ms
memory: 21540kb

input:

180898 999999014815
334450228466 503334784963
186830709333 693681893088
449404226182 784311456420
892646746348 940049353284
823917316374 919749528085
276319366247 947263894532
755922082752 874575510285
338067888164 367464529023
344022766233 904501703170
200314136804 628220987500
943403693445 9920364...

output:

2 180898

result:

ok 2 number(s): "2 180898"

Test #21:

score: 0
Accepted
time: 99ms
memory: 11860kb

input:

115971 999999514122
332911922913 398852633639
731886467352 805950656635
59059337874 704335692355
389411593433 522354279863
544753784841 790087545320
129918950919 342036960446
103322023911 803937872751
39649382365 963420168630
866233920562 905620006188
764993053035 849321238813
14992229330 7512668059...

output:

2 115971

result:

ok 2 number(s): "2 115971"

Test #22:

score: 0
Accepted
time: 185ms
memory: 23500kb

input:

192768 999999439479
498230628051 744382496510
304239236926 372870323833
18007344976 124743197690
54625426408 456773150988
994020333748 996903576609
311750073068 415542572176
449691032798 543681708454
320350305051 916273878215
901102038029 943525239638
258214446095 545695176133
236318045474 828226215...

output:

3 192768

result:

ok 2 number(s): "3 192768"

Test #23:

score: 0
Accepted
time: 103ms
memory: 14012kb

input:

108443 999999341365
53221339435 115446156985
300672764130 911228668020
531978250460 951983524623
829293539560 958020424223
341148564031 990108360152
951068864362 967399970839
806397854590 876385435586
952731384426 978808932850
949068864077 966859522406
220276075276 462299300428
264795813939 62286456...

output:

3 108443

result:

ok 2 number(s): "3 108443"

Test #24:

score: 0
Accepted
time: 65ms
memory: 12360kb

input:

123433 999999525048
126556719391 126565129743
586559992553 586560132976
158776656302 158777039337
472050869628 472055474984
64909968259 64916587400
916013990424 916021575164
482434589957 482447641384
901037441429 901050684363
812327939644 812348537548
308417205894 308428916143
620025267250 620025675...

output:

123433 123433

result:

ok 2 number(s): "123433 123433"

Test #25:

score: 0
Accepted
time: 83ms
memory: 19232kb

input:

133322 999999942139
44035860514 44050764417
646721153264 646728497889
135210336630 135246229851
388351600870 388356484866
660488389448 660494788270
216432940173 216443218549
461760936461 461762880878
645717678002 645719010092
514450078213 514451638333
795358855767 795372187091
874155341937 874157093...

output:

133322 133322

result:

ok 2 number(s): "133322 133322"

Test #26:

score: 0
Accepted
time: 112ms
memory: 19988kb

input:

184849 999999351144
431984304061 431984660839
250205459053 250205995164
964701611400 964711353284
382635327184 382652022204
784601952941 784604010827
831957256262 831957745519
457303083998 457314885171
472792171311 472802499924
553935869687 553937598677
274241008975 274242501694
404376973514 4043798...

output:

184849 184849

result:

ok 2 number(s): "184849 184849"

Test #27:

score: 0
Accepted
time: 88ms
memory: 18096kb

input:

133305 999999150833
277808551083 277808858774
548031618768 548037194721
339904394375 339906740225
206720306585 206729032833
45966250012 45968107374
951822054848 951829854396
652389450804 652393731772
980135722170 980138177585
675273675610 675284282513
741300463305 741309732503
938792962678 938793446...

output:

133305 133305

result:

ok 2 number(s): "133305 133305"

Test #28:

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

input:

125262 999999739261
527111546180 527140713840
446544124871 446545528054
37279102188 37281436408
173945510417 173946752953
587736219916 587740453998
363029765836 363041622283
959539838167 959543498684
68568747430 68578202566
837209751581 837210056566
248114346560 248129395046
831341096848 83135980816...

output:

125262 125262

result:

ok 2 number(s): "125262 125262"

Test #29:

score: 0
Accepted
time: 69ms
memory: 12044kb

input:

117036 999999207073
924898681342 924907280420
495168851503 495178535102
513244564026 513248946276
38797086309 38802495810
923257599624 923264249406
305315490421 305320461637
207246082431 207255819063
159625431783 159627657199
415272859663 415293560748
148795979069 148806928202
538688364118 538692413...

output:

117036 117036

result:

ok 2 number(s): "117036 117036"

Test #30:

score: 0
Accepted
time: 74ms
memory: 12228kb

input:

122772 999999619576
225695262376 225695383570
61720072372 61744130552
545469982599 545478997918
219411405482 219417424068
308399383732 308412854574
495409437309 495420146158
431287799207 431316361371
813528102588 813539059136
225519881360 225520992615
67807731180 67814500306
741549391761 74155861410...

output:

122772 122772

result:

ok 2 number(s): "122772 122772"

Test #31:

score: 0
Accepted
time: 112ms
memory: 18820kb

input:

176214 999999223579
158281525277 158283764698
336300196500 336314598715
158492961550 158514222617
937993800383 937998656728
91246633079 91247970218
809482574504 809492505553
528413829136 528425052353
734903390031 734906817200
14961847644 14962583055
720201793136 720202280599
540744914411 54074504669...

output:

176214 176214

result:

ok 2 number(s): "176214 176214"

Test #32:

score: 0
Accepted
time: 86ms
memory: 18148kb

input:

154454 999999726350
775213251453 775215208424
98845129269 98855562609
918315624821 918319316286
489780512835 489783549205
354733859624 354737416640
546367054415 546374141930
351552308836 351567969191
855179664309 855182489357
241678477201 241688153307
664653034396 664653186752
326030408645 326050128...

output:

154454 154454

result:

ok 2 number(s): "154454 154454"

Test #33:

score: 0
Accepted
time: 56ms
memory: 13256kb

input:

115078 999999245315
726164925974 726165360110
474649463740 474655039338
990086412665 990090397531
551847944476 551851225479
567540161609 567551469852
742245705160 742252733193
746598964496 746605284297
188464429152 188484724458
897480892021 897482113232
205131961158 205146617239
883179289108 8832025...

output:

115078 115078

result:

ok 2 number(s): "115078 115078"

Test #34:

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

input:

78 2234
843 1954
1253 2232
76 1630
1959 2182
846 1516
1593 2179
299 625
584 2212
1737 2234
0 1623
1204 2223
0 1393
0 704
1199 2234
2128 2233
166 2079
101 2234
0 313
26 2233
309 1350
589 2091
2162 2197
802 2205
929 2214
2170 2224
168 1973
1392 2100
0 285
0 934
1633 2234
291 981
0 1589
1000 1974
717 2...

output:

2 70

result:

ok 2 number(s): "2 70"

Test #35:

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

input:

30 5236
102 4343
2803 4386
344 5236
2580 3155
1545 4398
341 4397
630 5227
109 2790
883 5202
3093 5224
399 5042
3310 5227
3815 5223
3688 4881
3106 5229
4651 5236
3154 5235
3346 5236
4024 5234
0 179
0 43
2101 5215
0 1228
43 1420
3181 5213
2469 4777
1357 2215
1863 4716
854 5228
881 3355

output:

2 28

result:

ok 2 number(s): "2 28"

Test #36:

score: -100
Wrong Answer
time: 2ms
memory: 3560kb

input:

48 661
458 661
13 330
84 370
0 364
376 661
531 658
414 650
0 214
0 93
149 659
394 661
567 656
294 436
389 658
0 648
248 655
167 571
213 660
207 658
17 654
652 657
24 617
9 659
636 659
501 623
146 659
414 653
52 655
0 273
54 627
0 382
0 38
68 661
193 651
17 609
497 661
458 654
530 629
152 563
548 649...

output:

2 41

result:

wrong answer 2nd numbers differ - expected: '42', found: '41'