QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#831154 | #8907. Конференция | Coffins | 5 | 59ms | 5448kb | C++17 | 1.3kb | 2024-12-25 11:15:56 | 2024-12-25 11:16:28 |
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);
}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;
}
详细
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 0ms
memory: 3836kb
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: 3616kb
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: 3628kb
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: 0ms
memory: 3672kb
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: 4ms
memory: 3716kb
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: 7ms
memory: 3776kb
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: 59ms
memory: 5448kb
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: 52ms
memory: 5448kb
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: 1ms
memory: 3564kb
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 5 3 4
result:
ok answers are correct. (1 test case)
Test #10:
score: 0
Wrong Answer
time: 0ms
memory: 3552kb
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 7 4 2 5
result:
wrong answer answer size for input: 2, answer size in participant solution: 2 (test case 1)
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Wrong Answer
Test #39:
score: 0
Wrong Answer
time: 0ms
memory: 3608kb
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 5 8 4
result:
wrong answer answer size for input: 4, answer size in participant solution: 3 (test case 1)
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%