QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#167233#2990. IIIDXCidoai60 87ms32640kbC++141.3kb2023-09-07 13:04:252023-09-07 13:04:25

Judging History

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

  • [2023-09-07 13:04:25]
  • 评测
  • 测评结果:60
  • 用时:87ms
  • 内存:32640kb
  • [2023-09-07 13:04:25]
  • 提交

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(){
	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: 5
Accepted
time: 1ms
memory: 22348kb

input:

4 2.0
9 5 3 4

output:

3 5 4 9 

result:

ok single line: '3 5 4 9 '

Test #2:

score: 5
Accepted
time: 6ms
memory: 22232kb

input:

8 3.000
31 15 2 54 97 65 46 61

output:

54 2 97 65 61 46 31 15 

result:

ok single line: '54 2 97 65 61 46 31 15 '

Test #3:

score: 5
Accepted
time: 5ms
memory: 22500kb

input:

5 1.100
26 62 58 94 67

output:

26 58 62 67 94 

result:

ok single line: '26 58 62 67 94 '

Test #4:

score: 5
Accepted
time: 1ms
memory: 23560kb

input:

9 9.000
15 88 55 99 29 36 7 71 45

output:

88 71 55 45 36 29 15 7 99 

result:

ok single line: '88 71 55 45 36 29 15 7 99 '

Test #5:

score: 5
Accepted
time: 5ms
memory: 22652kb

input:

10 2.333
38 38 85 14 35 69 58 37 89 100

output:

38 14 69 38 37 35 100 89 85 58 

result:

ok single line: '38 14 69 38 37 35 100 89 85 58 '

Test #6:

score: 5
Accepted
time: 5ms
memory: 23040kb

input:

1 3.333
86

output:

86 

result:

ok single line: '86 '

Test #7:

score: 5
Accepted
time: 4ms
memory: 20964kb

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:

639939 441073320 683590 708316395 441672058 166351785 925547 862892302 709316564 583477729 441868524 304276671 167370432 65798344 1274919 932188826 863223754 787169513 709665832 644893225 583701801 510849769 442737741 376021494 306218560 233848779 167390192 110893711 65955027 27020521 1569058 964613...

result:

ok single line: '639939 441073320 683590 708316...790 26361360 25690700 25490546 '

Test #8:

score: 5
Accepted
time: 3ms
memory: 23184kb

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:

3993744 445094234 3993744 732258290 445094234 139648398 3993744 855547874 732258290 600918715 445094234 271839764 139648398 64416248 3993744 934871707 855547874 800778028 732258290 686238415 605633492 523492343 445094234 343453671 271839764 208061459 139648398 103524427 64416248 19169021 3993744 973...

result:

ok single line: '3993744 445094234 3993744 7322...338 19169021 19169021 18080328 '

Test #9:

score: 5
Accepted
time: 5ms
memory: 21800kb

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:

421438549 299758 817849682 616437715 421496480 213078780 61666646 883992 935769689 877779162 817878376 750525833 686056832 616931290 544691671 481753420 421960808 360786781 301716682 214199296 156816580 109658944 62407808 31382773 15645640 1046339 974966217 956109531 935995699 921231544 898704621 87...

result:

ok single line: '421438549 299758 817849682 616...410 38876691 38292726 36376810 '

Test #10:

score: 0
Wrong Answer
time: 3ms
memory: 21876kb

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:

390645993 2590306 800327124 596587717 390645993 202887162 57952168 2590306 903966106 875018503 800327124 702205293 639000551 596587717 503601877 458609710 390645993 324606253 258692790 202887162 133360102 100961312 57952168 25662683 19145504 2590306 974719269 956943859 903966106 895877371 885780070 ...

result:

wrong answer 1st lines differ - expected: '390645993 2590306 800327124 59...7816 28927816 28927816 34818749', found: '390645993 2590306 800327124 59...816 28927816 28927816 28927816 '

Test #11:

score: 5
Accepted
time: 5ms
memory: 21968kb

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:

802065619 630248249 444093505 269896370 116677159 2478080 952060523 929762282 909420457 890694885 858684963 832307168 802192185 773609401 747191883 720179497 687859238 661804343 630310546 606945203 584354638 548218023 524864103 500882116 474418984 444368672 418000567 385437667 358803886 328551819 30...

result:

ok single line: '802065619 630248249 444093505 ... 976678613 976027763 975711792 '

Test #12:

score: 0
Wrong Answer
time: 1ms
memory: 22192kb

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:

249198018 21576086 503406414 249198018 127031097 21576086 778914550 503406414 337602783 249198018 179787248 127031097 61502514 21576086 845898193 778914550 582416109 550326722 503406414 366842538 337602783 309157213 249198018 241473222 179787248 153239311 127031097 116504570 61502514 37966549 215760...

result:

wrong answer 1st lines differ - expected: '249198018 21576086 503406414 2...5 338102165 366842538 366842538', found: '249198018 21576086 503406414 2... 338102165 338102165 338102165 '

Test #13:

score: 0
Wrong Answer
time: 67ms
memory: 29660kb

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:

4209 436759152 4209 725066942 436759152 156044902 4209 861859784 725066942 581201642 436759152 294246483 156044902 58888672 4209 929100088 861859784 797240948 725066942 648761449 581201642 506053647 436759152 361733411 294246483 227023143 156044902 105085197 58888672 24915566 4209 965315492 92910008...

result:

wrong answer 1st lines differ - expected: '4209 436759152 4209 725066942 ...9593 36359593 36359593 36359593', found: '4209 436759152 4209 725066942 ...593 36359593 36359593 36359593 '

Test #14:

score: 0
Wrong Answer
time: 51ms
memory: 31220kb

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:

438962117 660193 804221164 613279803 438962117 229626704 76086932 660193 939882380 857382024 804221164 749294015 674843409 613279803 566227489 513544076 438962117 352355987 295481193 229626704 164138626 118270525 76086932 41681685 9042246 660193 978581914 959074973 939882380 907752835 889178830 8573...

result:

wrong answer 1st lines differ - expected: '438962117 660193 804221164 613...7931 29237931 29237931 29237931', found: '438962117 660193 804221164 613...496 19603496 19603496 19603496 '

Test #15:

score: 5
Accepted
time: 72ms
memory: 30076kb

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:

765536274 565297049 336934796 116943052 23559449 632 965763311 936045270 900319246 865004548 834864097 800235393 765537888 735642855 700307185 665500072 635730191 600588700 565301231 535327828 501110249 466355188 436161190 401317136 367242218 336935220 301900879 267011400 236799193 202374796 1670215...

result:

ok single line: '765536274 565297049 336934796 ...492 30259262 30258887 30258476 '

Test #16:

score: 5
Accepted
time: 87ms
memory: 31168kb

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:

409457234 208351230 1313 776663980 553518319 491351697 409458633 352177539 271598711 208353227 134970017 92402890 38012987 2331 920462262 856854977 776668714 712765583 630753928 571425864 553519674 530490468 514404200 491353061 473705158 450296815 432253839 409460066 393507812 369849525 352178322 32...

result:

ok single line: '409457234 208351230 1313 77666... 579672337 579667670 579660889 '

Test #17:

score: 0
Wrong Answer
time: 71ms
memory: 31432kb

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:

548027607 132054617 66848454 940241 904350273 775588378 656310970 548027607 483820240 379323252 274383576 159663404 132054617 113576773 99377069 81189684 66848454 48714043 32173999 19112375 9534209 940241 986018262 958351099 935025602 904350273 879140891 850813540 826703995 794778449 775588378 74716...

result:

wrong answer 1st lines differ - expected: '548027607 132054617 66848454 9...1 143207371 143207371 145023302', found: '548027607 132054617 66848454 9... 142209109 142209109 142209109 '

Test #18:

score: 0
Wrong Answer
time: 57ms
memory: 30168kb

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:

1034843 205156641 1034843 548695587 205156641 28872639 1034843 811089301 548695587 366967314 205156641 106681661 28872639 1034843 930404799 811439971 685250589 548695587 445590092 366967314 248795417 205156641 162824144 106681661 70674584 28872639 1034843 946836461 930404799 854259756 811439971 7408...

result:

wrong answer 1st lines differ - expected: '1034843 205156641 1034843 5486...4 207113694 207113694 207113694', found: '1034843 205156641 1034843 5486... 207113694 207113694 207113694 '

Test #19:

score: 0
Wrong Answer
time: 59ms
memory: 30596kb

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:

168588790 138613 644365687 426668964 168588790 74960070 138613 869263078 785749805 644365687 566773110 426668964 357537890 237226679 168588790 109983988 74960070 51771854 20429073 138613 954276379 921711375 869263078 828689367 785749805 742783381 707371913 644365687 607478191 566773110 539709893 490...

result:

wrong answer 1st lines differ - expected: '168588790 138613 644365687 426...0 154587020 154587020 154587020', found: '168588790 138613 644365687 426... 150676478 150676478 150676478 '

Test #20:

score: 0
Wrong Answer
time: 68ms
memory: 32640kb

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...

output:

474628750 5816 877193090 669024977 474628750 324229319 129210801 5816 951725058 877210811 801455282 746467687 669039556 595917457 519740834 474628750 397154894 324229319 268893514 192098431 129219221 96145583 48411697 7650 978792661 951725058 923669147 896121665 877210811 850402596 818374581 8014552...

result:

wrong answer 1st lines differ - expected: '474628750 5816 877193090 66902...2481932 2481932 2481932 2481932', found: '474628750 5816 877193090 66902...481932 2481932 2481932 2481932 '