QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#167120 | #2990. IIIDX | Cidoai# | 0 | 0ms | 0kb | C++14 | 1.3kb | 2023-09-07 08:54:32 | 2023-09-07 08:54:33 |
Judging History
answer
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
inline int read(){
int x=0;
int f=0,ch=0;
while(ch<48||ch>57) f=(ch=='-'),ch=getchar();
while(ch>47&&ch<58) x=(x<<3)+(x<<1)+(ch&15),ch=getchar();
return f?-x:x;
}
inline void write(int x,char end=' '){
if(x==0){
putchar('0');
putchar(end);
return;
}
if(x<0) putchar('-'),x=-x;
int ch[70]={0},cnt=0;
while(x){
ch[cnt++]=(int)(x%10);
x/=10;
}
while(cnt--) putchar(ch[cnt]+48);
putchar(end);
}
const int N=5e5+5;
int n;
double k;
int d[N],ans[N];
int du[N];
struct node{
int to,nxt;
}e[N<<1];
int head[N],cnt;
inline void add(int u,int v){
e[++cnt].to=v;
e[cnt].nxt=head[u];
head[u]=cnt;
}
int dep[N];
vector<int> storey[N];
int mx;
int now=1;
inline void dfs(int u,int fa){
storey[dep[u]].push_back(u);
for(int i=head[u];i;i=e[i].nxt){
int v=e[i].to;
dep[v]=dep[u]+1;
mx=mx>dep[v]?mx:dep[v];
ans[v]=d[now++];
dfs(v,u);
}
}
inline bool cmp(int x,int y){return x>y;}
int main(){
freopen("iiidx.in","r",stdin);
freopen("iiidx.out","w",stdout);
n=read(),scanf("%lf",&k);
for(int i=1;i<=n;++i) d[i]=read();
sort(d+1,d+n+1);
for(int i=1;i<=n;++i){
int to=floor((double)i/k);
add(to,i);
}
dfs(0,0);
for(int i=1;i<=n;++i) write(ans[i]);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Dangerous Syscalls
input:
4 2.0 9 5 3 4
output:
result:
Test #2:
score: 0
Dangerous Syscalls
input:
8 3.000 31 15 2 54 97 65 46 61
output:
result:
Test #3:
score: 0
Dangerous Syscalls
input:
5 1.100 26 62 58 94 67
output:
result:
Test #4:
score: 0
Dangerous Syscalls
input:
9 9.000 15 88 55 99 29 36 7 71 45
output:
result:
Test #5:
score: 0
Dangerous Syscalls
input:
10 2.333 38 38 85 14 35 69 58 37 89 100
output:
result:
Test #6:
score: 0
Dangerous Syscalls
input:
1 3.333 86
output:
result:
Test #7:
score: 0
Dangerous Syscalls
input:
1986 2.000 281295007 369543000 811574394 77532113 282225790 49445902 624452407 655720521 807581699 787169513 916890294 893096710 811681693 619388658 720357095 599550164 469242195 692961953 904464661 886425240 407991228 2456315 260548941 617078389 361663778 691708754 559248679 162773819 18033965 3680...
output:
result:
Test #8:
score: 0
Dangerous Syscalls
input:
1986 2.000 410358852 771659955 609020567 78010901 891539089 58470167 996405684 709265737 118335385 72626916 465005856 224956998 977265488 196399968 657949596 345289423 798156987 903811388 234327100 847271602 47598967 528935137 80448574 155437182 342444252 114510395 598707279 351220692 466768959 9279...
output:
result:
Test #9:
score: 0
Dangerous Syscalls
input:
1989 3.000 990864107 642150955 155463337 92945547 566987168 613942275 571349910 125615127 90015994 520882482 482177513 945162640 850442966 422843075 685269653 99650208 499754581 36272980 277930567 17252979 600991186 714594241 2081442 899198830 839621423 764176107 561473786 130748352 380445610 866909...
output:
result:
Test #10:
score: 0
Dangerous Syscalls
input:
1989 3.000 25662683 386690509 471933555 615075359 22546939 34818749 626732057 792200516 471006685 653186188 901875472 244615213 390645993 633933259 38810248 983486968 675189604 675189604 784732242 38810248 792200516 567616754 626732057 684398656 271837278 238805988 872887631 431850121 903966106 3331...
output:
result:
Test #11:
score: 0
Dangerous Syscalls
input:
1999 6.523 337250772 530507854 641691531 138621890 7527603 551560640 403442319 595955055 615491869 132117477 19858651 909420457 802364987 296972240 477926758 443054437 936505287 125010807 595483861 881929447 37359990 481564722 506388073 261568083 788166345 46836286 713348293 780896918 132914700 5070...
output:
result:
Test #12:
score: 0
Dangerous Syscalls
input:
1999 2.123 780045250 153239311 309157213 29562070 294834889 780045250 337602783 357106666 179787248 294834889 550326722 331413909 880980880 875130647 366842538 880980880 21576086 467718250 554430349 778914550 525347896 338102165 467718250 830781157 554430349 557349626 249198018 821179692 631762899 5...
output:
result:
Test #13:
score: 0
Dangerous Syscalls
input:
498765 2.000 58107723 618698520 100249493 373660543 97564333 117796271 51411872 464112788 142651213 219200625 547359830 403878568 146585233 30781754 740842250 708454458 477069340 848102107 798653859 100249493 645810221 265305480 848501819 669774419 62982467 335502222 697325602 112743145 965055098 62...
output:
result:
Test #14:
score: 0
Dangerous Syscalls
input:
500000 3.000 9042246 202940352 43272064 800855306 743910648 807487381 43272064 615067766 857382024 76086932 972574673 647380659 577870378 567053734 76327550 310307945 444518674 429782580 613279803 342467758 150028977 577870378 78604228 844435178 709135656 207337247 500274314 432450797 733473710 5004...
output:
result:
Test #15:
score: 0
Dangerous Syscalls
input:
500000 6.666 687629251 725725373 377584674 789067458 745891542 13609480 340943012 588686633 292431935 333790521 497513034 430914272 243282836 816494436 165675153 133056947 445790460 832770546 914901024 185219181 415577102 602213968 284480221 10427020 242834056 770096576 368977456 511413070 28294552 ...
output:
result:
Test #16:
score: 0
Dangerous Syscalls
input:
500000 3.526 251575195 880559884 302464608 669160226 68868182 881391252 762642602 250418843 332747975 962841429 60560019 180497268 410436706 875122869 51000516 514949651 444300442 13863163 411847306 137596125 350377403 151555710 7011427 383942355 74972874 938293131 563525997 99346734 942546998 54704...
output:
result:
Test #17:
score: 0
Dangerous Syscalls
input:
500000 4.500 77285882 347720767 911705537 776587768 774249073 490272904 883923821 940241 157476532 352488958 110028472 342016631 157476532 771373777 524881498 217596011 170708299 341952542 671978059 39229697 750607498 960786354 429687148 643111371 852737293 852737293 187363480 170708299 986018262 93...
output:
result:
Test #18:
score: 0
Dangerous Syscalls
input:
500000 1.865 886232424 31938153 95550197 232682690 537426339 175267421 816697451 848319174 61371162 930404799 23279758 352055652 870933174 863413833 61116212 559312628 937512167 944390122 162824144 379141335 381507405 940890734 367214858 944761522 508213584 152082099 619777933 79637471 535898589 501...
output:
result:
Test #19:
score: 0
Dangerous Syscalls
input:
500000 2.560 862379585 689468510 971090515 539709893 257730100 605063548 554280955 656731612 654467610 291195472 165627350 850981485 933583024 98671776 799427557 305899863 814781661 199669971 807770925 909918748 244558259 113052839 882579521 283970656 93897189 349431777 222009441 589011084 942407018...
output:
result:
Test #20:
score: 0
Dangerous Syscalls
input:
500000 2.690 550310400 164214680 463562328 688869176 87744368 782564579 923140216 324740484 239974566 511094619 827941383 145764776 158271562 820642676 687448291 173834606 322711736 577801491 495952875 800456607 583758834 133066095 519735912 41476830 317069788 423262078 606309582 907207417 312877355...