QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#831162 | #8907. Конференция | Coffins | 5 | 22ms | 5280kb | C++17 | 1.3kb | 2024-12-25 11:21:45 | 2024-12-25 11:21:45 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define All(x) \
x.begin(),x.end()
using vi=vector<int>;
const int N=1e5+5;
int n,l[N],r[N],id[N];
bool cmp1(int x,int y)
{return (r[x]==r[y])?
(l[x]>l[y]):(r[x]<r[y]);}
bool cmp2(int x,int y)
{return (l[x]==l[y])?
(r[x]<r[y]):(l[x]>l[y]);}
int mj[N],m;bool tg[N];
void solve()
{
cin>>n;m=0;iota(id+1,id+n+1,1);
for(int i=1;i<=n;i++)tg[i]=0;
for(int i=1;i<=n;i++)cin>>l[i]>>r[i];
sort(id+1,id+n+1,cmp1);int cr=-1;
/*cout<<"===\n";
for(int i=1;i<=n;i++)
{
cout<<l[id[i]]<<' '<<r[id[i]]<<'\n';
}*/
for(int i=1;i<=n;i++)
if(l[id[i]]>cr)tg[i]=1,
cr=r[id[i]],mj[++m]=i;
vi vL,vR;for(int i=1;i<=n;i++)if(!tg[i])
{
if(i<=mj[m/2])vL.push_back(i);
else vR.push_back(i);
}reverse(vR.begin(),vR.end());
if(vL.size()>vR.size())
{
while(vL.size()+m/2>n/2)vL.pop_back();
for(int i=1;i<=m/2;i++)cout<<id[mj[i]]<<' ';
for(int c:vL)cout<<id[c]<<' ';cout<<'\n';
}else
{
while(vR.size()+m/2>n/2)vR.pop_back();
for(int i=m/2+1;i<=m;i++)cout<<id[mj[i]]<<' ';
for(int c:vR)cout<<id[c]<<' ';cout<<'\n';
}
}
int main()
{
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int t;cin>>t;while(t--)solve();return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 1ms
memory: 3572kb
input:
1 4 823983109 859315505 510901709 589624124 351308325 413158126 29447781 138101981
output:
2 1
result:
ok answers are correct. (1 test case)
Test #2:
score: 5
Accepted
time: 0ms
memory: 3644kb
input:
1 10 344190293 385750493 951894838 978895800 82358344 338131819 540516504 607653166 820688970 951835774 395392706 419489159 623802732 644208366 798160348 818154082 680378878 682083538 467019518 519267671
output:
7 9 8 5 2
result:
ok answers are correct. (1 test case)
Test #3:
score: 5
Accepted
time: 1ms
memory: 3808kb
input:
1 500 943625790 945741848 367933677 368747115 117030592 118328257 321658393 322265356 413440931 413466704 191801051 192382494 45318188 45578563 184352813 184557169 267846012 270194842 787080743 789209469 102034755 102793278 677264139 679983858 858429750 858446103 879077624 879224701 573990877 574468...
output:
349 263 48 105 477 165 318 58 189 269 275 55 216 307 339 16 161 64 389 83 156 497 224 111 24 15 188 166 362 26 382 228 213 481 260 17 439 127 388 100 108 304 437 217 256 268 442 286 414 341 53 453 236 206 198 476 254 20 421 154 289 208 182 283 364 158 435 452 367 399 175 199 115 470 328 159 361 385 ...
result:
ok answers are correct. (1 test case)
Test #4:
score: 5
Accepted
time: 1ms
memory: 3648kb
input:
1 1000 724221604 725069540 143194275 144876990 944969667 945425601 692430254 692500244 413915365 415513016 441154319 441817251 397426964 397797495 573976568 574310166 333482080 333658815 692670858 693494033 781215754 781315542 297042073 297766151 347972954 348085089 567271813 567539623 43283944 4381...
output:
918 630 31 905 521 787 998 941 979 445 994 753 552 845 836 612 697 598 921 518 122 574 90 588 101 135 567 933 233 485 474 880 888 785 876 558 818 70 50 375 975 951 981 547 527 218 711 104 626 28 162 419 805 151 63 596 342 650 560 486 510 460 563 837 177 514 253 76 523 863 14 923 662 930 343 8 927 42...
result:
ok answers are correct. (1 test case)
Test #5:
score: 5
Accepted
time: 2ms
memory: 3816kb
input:
1 10000 1915 1916 6871 6872 12925 12926 12679 12680 18809 18810 4725 4726 12781 12782 6363 6364 18471 18472 17037 17038 13225 13226 12201 12202 8365 8366 11427 11428 2859 2860 18423 18424 3519 3520 14647 14648 17649 17650 11249 11250 9003 9004 15623 15624 11345 11346 457 458 4805 4806 17905 17906 84...
output:
4879 3503 9799 6882 267 935 7751 8304 9762 7655 615 9112 9469 9882 6637 8212 9218 657 6858 9805 9838 9755 1547 6525 4444 3515 4620 6596 4109 6516 4042 880 8788 1302 7963 2586 8556 998 6962 1297 6224 9059 1479 2940 2787 1710 729 3273 8542 765 8189 5790 4151 184 882 2516 8780 4968 272 9424 6263 6814 3...
result:
ok answers are correct. (1 test case)
Test #6:
score: 5
Accepted
time: 3ms
memory: 3968kb
input:
1 10000 951623572 951627967 944693469 944698949 866936571 866953676 708414261 708441197 918925455 918994693 693014496 693052258 500076831 500117857 346961903 346994890 790230509 790247658 486707346 486907093 703108219 703186545 666115252 666249778 638756819 638771288 605550898 605661894 618156528 61...
output:
8291 6626 8748 1906 3904 820 2596 7813 34 8033 9921 4062 3549 3951 9358 532 3777 7291 7452 9258 4292 4758 1111 5994 5478 4242 8095 9521 7454 7 5030 16 7909 2303 6081 256 2252 5195 9903 6515 5371 5541 7329 6753 7558 5960 4550 6747 6283 8473 5347 7316 5561 2028 6801 5913 7016 6028 1002 5983 4723 3913 ...
result:
ok answers are correct. (1 test case)
Test #7:
score: 5
Accepted
time: 20ms
memory: 5216kb
input:
1 100000 95477550 95482342 57260360 57270968 324158435 324161602 337960344 337966333 843677712 843688311 61482892 61483547 494172231 494182559 843751785 843754290 158705730 158714372 136974660 136976009 424424906 424425379 802041471 802042132 670649961 670659516 155724598 155724784 245837370 2458388...
output:
97588 17649 83155 2536 982 38888 88197 31150 48254 11586 1555 5451 13778 31991 51828 50763 52598 96708 37990 189 38719 72504 16688 90576 8940 32923 45307 28008 75988 95509 7394 54537 94136 8070 82179 90045 46561 64826 9704 98288 2863 26360 1065 81741 28831 97118 70295 23612 47485 86642 24720 45622 7...
result:
ok answers are correct. (1 test case)
Test #8:
score: 5
Accepted
time: 22ms
memory: 5280kb
input:
1 100000 126151 126152 147685 147686 168691 168692 124505 124506 58489 58490 98015 98016 173339 173340 39469 39470 135733 135734 53105 53106 118229 118230 46503 46504 36953 36954 185819 185820 27699 27700 64063 64064 60847 60848 18307 18308 1697 1698 109113 109114 99305 99306 72117 72118 107975 1079...
output:
20349 42433 79666 31091 46536 50509 97284 43758 68279 24744 88950 88892 21893 64600 15770 91529 63672 67863 91337 33200 40146 55813 93169 30543 94503 92820 97523 53085 20759 93869 41357 12906 64954 9852 6735 84202 80855 43224 41434 29410 24079 72645 98221 38045 75666 82890 18364 52504 71733 92536 71...
result:
ok answers are correct. (1 test case)
Subtask #2:
score: 0
Wrong Answer
Test #9:
score: 20
Accepted
time: 0ms
memory: 3828kb
input:
1 10 4 6 15 20 1 12 11 16 3 10 13 19 5 18 7 8 2 17 9 14
output:
10 2 6 7 9
result:
ok answers are correct. (1 test case)
Test #10:
score: 20
Accepted
time: 0ms
memory: 3824kb
input:
1 10 117956745 973823632 23571766 719701618 38785378 558526309 231187237 674007540 733362426 831144169 89816954 851213129 249341944 612792325 373425880 852493895 483542387 985564497 696597340 810358170
output:
10 9 1 8 6
result:
ok answers are correct. (1 test case)
Test #11:
score: 20
Accepted
time: 0ms
memory: 3516kb
input:
1 14 16686983 932034450 223405271 642058261 317002236 708563919 199994594 587702670 454769448 522126055 746578284 809511289 133298121 894605432 94273255 452589074 5923134 643331337 350619519 385885046 317742836 915325929 320415015 743405145 48507375 963122902 124278107 221614208
output:
5 6 13 1 11 7 12
result:
ok answers are correct. (1 test case)
Test #12:
score: 20
Accepted
time: 0ms
memory: 3564kb
input:
1 16 100212181 610959822 59569481 946341427 168724782 490902631 156501761 504380971 25798133 52287573 318331091 915496014 208509217 366012539 288068792 715557962 256907803 526058782 50050253 126428948 104145448 301925232 146518183 863900618 639034909 804627990 412452373 490792746 108316345 249279177...
output:
14 13 2 6 12 8 1 9
result:
ok answers are correct. (1 test case)
Test #13:
score: 20
Accepted
time: 0ms
memory: 3568kb
input:
1 20 456674597 608693437 109249158 596412179 370495893 870389856 488084264 934790215 442774596 811747447 872496853 921725870 376801154 471157541 845813365 998784402 228965099 809754209 382052625 391934909 259367607 683974291 670301847 878762117 35222309 784937368 185199365 910293412 413659466 752376...
output:
1 12 8 17 4 6 14 3 20 5
result:
ok answers are correct. (1 test case)
Test #14:
score: 20
Accepted
time: 0ms
memory: 3828kb
input:
1 20 297037250 419041198 282321805 321064650 349747242 362433069 351288380 375542434 419041198 445887196 602441780 958674622 241096289 375542434 475310449 592319891 349747242 913534896 383581240 419041198 173682409 328216346 328216346 603578694 472233867 801490971 95678652 168142402 168373452 387862...
output:
10 8 18 6 17 9 13 12 5 1
result:
ok answers are correct. (1 test case)
Test #15:
score: 20
Accepted
time: 0ms
memory: 3580kb
input:
1 20 414632002 543806183 925805922 929091516 635760918 935185417 363667984 414632002 367022099 862453723 417689885 547896642 134334204 417689885 65069763 927973748 547896642 882308193 65069763 781505290 263762476 560812886 559742181 929091516 134334204 547896642 547896642 589976615 110485699 9290915...
output:
14 2 3 15 12 8 19 16 9 5
result:
ok answers are correct. (1 test case)
Test #16:
score: 20
Accepted
time: 0ms
memory: 3512kb
input:
1 20 329453252 360742558 89402460 286183994 89402460 360742558 89402460 855784898 286183994 360742558 731929589 996880390 947477154 996880390 286183994 329453252 886845999 947477154 947477154 996880390 855784898 886845999 855784898 947477154 360742558 996880390 329453252 360742558 89402460 360742558...
output:
11 10 13 6 18 7 17 12 9 4
result:
ok answers are correct. (1 test case)
Test #17:
score: 20
Accepted
time: 0ms
memory: 3628kb
input:
1 18 202540904 389043517 226910816 248116434 63938984 546305677 140915764 499772247 49838487 549773488 447779853 755008234 533058173 810427590 285195967 754382401 637925690 745236874 124462413 429325871 337679536 747589476 524818542 789436305 99818393 333713311 365323277 797802647 621572224 86322465...
output:
9 18 15 7 14 12 6 8 11
result:
ok answers are correct. (1 test case)
Test #18:
score: 20
Accepted
time: 0ms
memory: 3628kb
input:
1 20 5 29 3 26 28 32 16 37 30 31 9 18 12 40 20 39 24 34 8 23 2 15 10 11 7 13 14 38 1 27 17 36 22 35 25 33 4 21 6 19
output:
5 7 8 14 4 16 17 9 18 3
result:
ok answers are correct. (1 test case)
Test #19:
score: 20
Accepted
time: 0ms
memory: 3792kb
input:
1 20 485722088 852895392 180584674 212943100 66284389 595168707 2136725 669530231 56269137 678699628 320676083 957135819 596929135 788062700 124202451 346702760 302036371 939376831 39652702 316659144 561860366 877505895 290483397 969059389 256661759 825834533 7051957 255090916 25578269 614441405 579...
output:
18 12 6 19 9 17 11 1 13 7
result:
ok answers are correct. (1 test case)
Test #20:
score: 20
Accepted
time: 0ms
memory: 3868kb
input:
1 20 377259628 382099996 69472389 220349448 393265432 765479011 294596292 404572923 118284478 181270154 643688338 650238709 746999817 921253559 714973742 936522293 692298392 935037128 6892369 351174639 279506178 445398706 527519195 833951836 770865464 927351496 76532474 294108433 263985397 436457230...
output:
6 19 8 9 13 7 12 20 3 18
result:
ok answers are correct. (1 test case)
Test #21:
score: 0
Wrong Answer
time: 0ms
memory: 3576kb
input:
1 20 422854059 481170824 437404694 545549659 104747483 235762834 26069209 210102693 247195443 329574823 668050357 676060905 666824938 742513110 800843882 976578863 485027093 574722004 112136604 121743796 22030602 122637670 569273785 573750615 569699277 573736325 725853453 854844997 647010820 7594164...
output:
13 6 17 8 14 15 7 9 12 2
result:
wrong answer answer size for input: 6, answer size in participant solution: 4 (test case 1)
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Wrong Answer
Test #39:
score: 15
Accepted
time: 0ms
memory: 3604kb
input:
1 10 8 9 15 18 12 13 5 14 7 10 1 20 2 19 6 11 3 4 16 17
output:
3 10 6 7 2
result:
ok answers are correct. (1 test case)
Test #40:
score: 15
Accepted
time: 0ms
memory: 3576kb
input:
1 100 152 159 63 64 101 102 105 106 90 175 114 173 181 190 37 44 186 189 126 127 135 138 27 34 136 137 76 77 149 164 129 130 17 18 68 71 66 73 11 12 47 48 67 72 49 54 21 22 118 121 3 4 117 170 83 194 91 112 124 133 139 140 85 88 151 162 86 87 84 89 116 171 30 31 6 9 46 195 92 97 14 15 125 132 39 42 ...
output:
34 61 3 4 89 98 10 16 13 31 81 56 73 47 92 55 78 67 53 79 74 39 28 50 83 99 7 9 82 5 72 6 68 36 27 100 46 48 65 91 15 88 33 1 45 52 11 30 42 54
result:
ok answers are correct. (1 test case)
Test #41:
score: 15
Accepted
time: 0ms
memory: 3636kb
input:
1 100 192 193 83 84 38 39 33 34 120 121 19 20 118 119 175 176 13 14 74 75 154 155 101 102 68 69 146 147 81 82 89 90 53 54 190 191 181 182 48 49 139 140 40 41 72 73 116 117 1 200 124 125 4 145 9 50 150 151 112 113 27 28 122 123 5 126 46 47 152 153 29 30 91 92 25 26 188 189 110 111 104 105 11 12 179 1...
output:
96 64 40 30 79 24 7 5 32 26 63 48 92 76 85 78 21 59 51 14 77 29 35 11 91 94 95 53 56 61 90 100 47 8 74 43 19 65 97 39 18 1 87 71 68 25 83 54 27 33
result:
ok answers are correct. (1 test case)
Test #42:
score: 15
Accepted
time: 0ms
memory: 3608kb
input:
1 100 189264773 692317517 166821159 730826701 132093661 747760156 244413340 258044743 425913239 571468467 345436794 608324228 414722760 580844232 4880692 979509087 381662564 593964118 15895639 957413704 17946557 939078604 73528693 867087267 18964638 919816261 39059497 884193691 278085494 635574530 2...
output:
95 53 28 96 52 84 8 86 80 32 77 68 10 74 11 66 75 13 57 31 26 59 92 34 14 100 18 45 23 12 91 67 62 58 17 39 61 21 42 65 56 48 44 3 70 24 81 98 50 2
result:
ok answers are correct. (1 test case)
Test #43:
score: 15
Accepted
time: 0ms
memory: 3636kb
input:
1 100 327645749 329093539 980227412 994005154 579806213 598354521 898396499 898525148 545535670 547099732 57665434 63966759 91822376 112410483 898974428 932154782 174406471 268197958 272306427 273971634 389680998 390221315 3154994 997314160 269858259 282937852 343400516 407809409 620512844 631492929...
output:
5 59 24 3 15 36 58 74 70 29 71 57 67 69 97 83 99 78 95 4 65 76 86 63 47 12 33 2 89 42 22 8 25 41 82 77 72 18 17 96 49 88 98 40 46 80 53 32 81 39
result:
ok answers are correct. (1 test case)
Test #44:
score: 15
Accepted
time: 0ms
memory: 3796kb
input:
1 100 19022424 295717821 521909470 631285980 497332842 642316879 652870043 654095607 1416391 996731107 325050618 333648846 854687185 897107660 53041861 61991654 182273029 231298999 38904128 236257569 307694478 357691523 579993158 583091697 239954119 244805531 434287435 485536294 225429937 226370246 ...
output:
44 12 81 4 89 35 64 86 38 91 50 56 90 79 84 40 94 46 23 83 5 57 21 65 30 49 92 85 54 7 96 75 27 63 78 59 100 34 47 67 43 73 98 3 72 2 28 95 17 22
result:
ok answers are correct. (1 test case)
Test #45:
score: 15
Accepted
time: 0ms
memory: 3584kb
input:
1 500 689426082 689507542 427389970 430516694 305033996 305649163 125494668 126279290 235974559 238575143 113585036 123617477 809213065 811464735 695392709 697437354 44577991 45927754 356984995 358581387 853780607 858598288 494073918 494101939 531949799 532852851 910230931 912010323 496284517 500744...
output:
186 252 97 430 495 13 245 71 259 207 46 116 197 93 419 251 409 272 231 388 161 458 390 447 368 303 333 374 456 304 295 151 440 313 286 310 81 1 297 8 246 83 44 126 372 240 226 361 216 457 72 61 95 102 86 55 340 262 271 248 238 7 74 37 154 451 159 281 434 23 84 163 182 52 336 323 98 255 342 261 70 10...
result:
ok answers are correct. (1 test case)
Test #46:
score: 15
Accepted
time: 0ms
memory: 3868kb
input:
1 500 298167304 298463628 791031018 794720207 659273641 659882121 104798428 105261813 211419472 211890862 743609251 750342623 785451379 825218182 161739521 165868601 668366592 670883708 17846664 980939732 623757216 629418838 57011271 280805195 702352076 702445129 242115912 248568730 392104305 412710...
output:
477 312 404 217 246 328 434 176 428 365 216 468 121 483 90 437 4 196 288 361 342 263 419 282 24 174 379 278 438 132 25 119 373 142 5 244 417 211 366 376 306 225 14 95 346 340 256 398 445 74 59 57 1 64 377 457 493 126 92 472 130 360 155 442 291 416 492 353 151 43 347 203 496 169 397 497 331 26 40 231...
result:
ok answers are correct. (1 test case)
Test #47:
score: 0
Wrong Answer
time: 0ms
memory: 3520kb
input:
10 60 11164929 994881562 299556408 474028014 66299485 119766199 432871164 460158656 132161383 176718496 271951527 606038754 539359133 553976140 949470174 958412706 661828987 994881562 12788677 49941342 891211584 895712102 724455378 983161900 152648130 160372649 225338436 227986635 949470174 97419152...
output:
7 52 57 21 55 23 39 11 50 29 53 1 9 12 34 33 27 15 54 8 59 16 20 48 32 43 30 36 31 26 11 13 2 14 6 12 5 3 1 4 45 65 9 62 88 100 10 61 70 57 7 59 48 43 82 84 28 63 38 64 80 11 78 67 51 71 74 72 66 39 85 23 4 19 21 30 87 58 31 95 6 68 32 42 22 96 24 92 73 40 36 59 86 40 71 79 83 116 27 58 105 87 1...
result:
wrong answer answer size for input: 12, answer size in participant solution: 7 (test case 6)
Subtask #5:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #4:
0%
Subtask #6:
score: 0
Skipped
Dependency #2:
0%
Subtask #7:
score: 0
Skipped
Dependency #2:
0%
Subtask #8:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%