Logo Wy Online Judge

WyOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#671#116. 【0621 模拟赛】OBILAZAKhandezheng10011ms5640kbC++14613b2025-06-21 15:45:382025-06-21 23:51:53

answer

#include<bits/stdc++.h>
#define int long long
#define F(i,l,r) for(int i=(l); i<=(r); i++)
using namespace std;
const int N= 1e6 +50, M= 1e3 +50;
const int INF=0x3f3f3f3f3f3f3f3f, mod=1e9+7;

int idx[M][M];
int K,a[N],now;

inline void DFS(int h,int c){
	if(h!=K){
		DFS(h+1,c*2-1);
		idx[h][c] = a[++now];
		DFS(h+1,c*2);
	}else{
		idx[h][c] = a[++now];
	}
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	
	cin>>K;
	F(i,1,pow(2,K)-1) cin>>a[i];
	DFS(1,1);
	int J=1;
	F(i,1,K){
		F(j,1,J) cout<<idx[i][j]<<' ';
		cout<<'\n';
		J<<=1;
	}

	return 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 5600kb

input:

10
441 314 935 337 172 628 445 670 715 953 761 525 432 951 217 785 577 933 855 275 178 664 198 298 4...

output:

404 
602 213 
147 737 965 842 
42 730 351 430 494 493 490 141 
248 974 681 618 505 196 207 805 255 6...

result:

ok 1023 tokens

Test #2:

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

input:

4
10 9 3 11 8 14 15 12 7 13 2 1 4 6 5

output:

12 
11 1 
9 14 13 6 
10 3 8 15 7 2 4 5 

result:

ok 15 tokens

Test #3:

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

input:

5
15 23 28 30 4 9 27 19 24 3 29 7 22 17 20 26 8 6 13 1 14 5 11 25 2 31 18 16 10 12 21

output:

26 
19 25 
30 7 1 16 
23 9 3 17 6 5 31 12 
15 28 4 27 24 29 22 20 8 13 14 11 2 18 10 21 

result:

ok 31 tokens

Test #4:

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

input:

6
54 6 31 5 26 60 25 46 49 43 33 51 21 28 22 36 7 9 35 39 58 37 59 32 3 48 42 15 18 23 10 12 17 30 5...

output:

12 
36 50 
46 32 8 56 
5 51 39 15 45 16 63 20 
6 60 43 28 9 37 48 23 30 13 61 55 47 38 4 1 
54 31 26...

result:

ok 63 tokens

Test #5:

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

input:

7
116 56 50 18 15 46 36 96 32 77 85 25 76 74 47 10 121 51 86 4 101 79 63 115 75 62 114 28 122 100 17...

output:

35 
45 5 
10 9 30 11 
96 115 21 88 26 83 117 78 
18 25 4 28 105 107 87 123 57 73 81 53 16 48 102 52 ...

result:

ok 127 tokens

Test #6:

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

input:

8
18 138 3 122 199 40 92 144 165 219 196 237 223 60 1 124 65 145 128 107 108 155 62 187 150 29 53 25...

output:

162 
13 42 
216 112 8 130 
124 97 157 12 250 208 185 102 
144 187 230 49 82 136 69 197 141 75 195 18...

result:

ok 255 tokens

Test #7:

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

input:

9
32 353 216 63 482 469 367 60 275 244 109 87 158 505 510 419 71 41 504 128 284 445 264 381 461 59 2...

output:

453 
312 362 
12 10 509 161 
263 288 301 142 365 145 104 192 
419 283 502 97 471 234 316 295 27 25 2...

result:

ok 511 tokens

Test #8:

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

input:

10
373 367 555 336 718 176 655 152 816 779 736 527 107 357 333 936 714 188 185 543 855 759 350 364 6...

output:

568 
1010 1012 
290 132 772 893 
564 894 667 265 264 761 671 15 
190 134 582 282 337 602 181 477 514...

result:

ok 1023 tokens

Test #9:

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

input:

10
400 58 680 758 18 699 340 5 192 936 916 362 142 236 383 801 12 753 622 205 428 486 499 341 979 95...

output:

559 
883 116 
51 320 195 732 
277 687 866 653 128 174 652 317 
76 466 85 171 855 455 542 696 415 523...

result:

ok 1023 tokens