QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#570873 | #8300. Game Design | ship2077 | AC ✓ | 1ms | 3988kb | C++23 | 706b | 2024-09-17 18:35:25 | 2024-09-17 18:35:28 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
constexpr int M=1e5+5,lim=1e9;
int n,num,fa[M],val[M];
void solve(int x,int rec){
if (rec==1) return val[x]=1,void();
if (~rec&1){
int cur=++num;
fa[cur]=x;
solve(cur,rec-1);
val[x]=val[cur];
return;
}
int ls=++num,rs=++num;
fa[ls]=fa[rs]=x;
solve(ls,2);solve(rs,rec>>1);
val[x]=min(lim,val[ls]+val[rs]);
}
int main(){
scanf("%d",&n);
if (n==1) return puts("2\n1\n114514 1919810"),0;
num=1;solve(1,n);printf("%d\n",num);
for (int i=2;i<=num;i++) printf("%d ",fa[i]);puts("");
for (int i=1;i<=num;i++) printf("%d ",val[i]);puts("");
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3796kb
input:
2
output:
2 1 1 1
result:
ok correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
1
output:
2 1 114514 1919810
result:
ok correct
Test #3:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
3
output:
4 1 1 2 2 1 1 1
result:
ok correct
Test #4:
score: 0
Accepted
time: 0ms
memory: 3932kb
input:
4
output:
5 1 2 2 3 2 2 1 1 1
result:
ok correct
Test #5:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
5
output:
5 1 1 2 3 2 1 1 1 1
result:
ok correct
Test #6:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
6
output:
6 1 2 2 3 4 2 2 1 1 1 1
result:
ok correct
Test #7:
score: 0
Accepted
time: 0ms
memory: 3980kb
input:
7
output:
7 1 1 2 3 3 5 3 1 2 1 1 1 1
result:
ok correct
Test #8:
score: 0
Accepted
time: 0ms
memory: 3944kb
input:
8
output:
8 1 2 2 3 4 4 6 3 3 1 2 1 1 1 1
result:
ok correct
Test #9:
score: 0
Accepted
time: 0ms
memory: 3988kb
input:
9
output:
8 1 1 2 3 5 5 6 3 1 2 1 2 1 1 1
result:
ok correct
Test #10:
score: 0
Accepted
time: 0ms
memory: 3988kb
input:
11
output:
8 1 1 2 3 3 5 6 3 1 2 1 1 1 1 1
result:
ok correct
Test #11:
score: 0
Accepted
time: 0ms
memory: 3980kb
input:
23
output:
11 1 1 2 3 3 5 6 6 8 9 4 1 3 1 1 2 1 1 1 1 1
result:
ok correct
Test #12:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
64
output:
17 1 2 2 3 4 4 6 7 7 9 10 10 12 13 13 15 6 6 1 5 1 1 4 1 1 3 1 1 2 1 1 1 1
result:
ok correct
Test #13:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
87
output:
18 1 1 2 3 3 5 6 6 8 9 11 11 12 13 15 15 16 6 1 5 1 1 4 1 1 3 1 3 1 2 1 2 1 1 1
result:
ok correct
Test #14:
score: 0
Accepted
time: 0ms
memory: 3980kb
input:
103
output:
18 1 1 2 3 3 5 6 6 8 9 11 11 12 13 13 15 16 6 1 5 1 1 4 1 1 3 1 3 1 2 1 1 1 1 1
result:
ok correct
Test #15:
score: 0
Accepted
time: 1ms
memory: 3976kb
input:
128
output:
20 1 2 2 3 4 4 6 7 7 9 10 10 12 13 13 15 16 16 18 7 7 1 6 1 1 5 1 1 4 1 1 3 1 1 2 1 1 1 1
result:
ok correct
Test #16:
score: 0
Accepted
time: 0ms
memory: 3940kb
input:
325
output:
25 1 1 2 3 5 5 6 7 9 9 10 11 11 13 14 14 16 17 17 19 20 22 22 23 8 1 7 1 7 1 6 1 6 1 5 1 1 4 1 1 3 1 1 2 1 2 1 1 1
result:
ok correct
Test #17:
score: 0
Accepted
time: 0ms
memory: 3988kb
input:
567
output:
28 1 1 2 3 3 5 6 6 8 9 11 11 12 13 15 15 16 17 19 19 20 21 21 23 24 24 26 9 1 8 1 1 7 1 1 6 1 6 1 5 1 5 1 4 1 4 1 3 1 1 2 1 1 1 1
result:
ok correct
Test #18:
score: 0
Accepted
time: 0ms
memory: 3984kb
input:
9999
output:
41 1 1 2 3 3 5 6 6 8 9 9 11 12 14 14 15 16 16 18 19 19 21 22 22 24 25 27 27 28 29 31 31 32 33 35 35 36 37 37 39 13 1 12 1 1 11 1 1 10 1 1 9 1 9 1 8 1 1 7 1 1 6 1 1 5 1 5 1 4 1 4 1 3 1 3 1 2 1 1 1 1
result:
ok correct
Test #19:
score: 0
Accepted
time: 0ms
memory: 3980kb
input:
93256
output:
53 1 2 2 3 4 4 6 7 7 9 10 12 12 13 14 14 16 17 17 19 20 22 22 23 24 24 26 27 27 29 30 30 32 33 35 35 36 37 39 39 40 41 41 43 44 46 46 47 48 50 50 51 16 16 1 15 1 1 14 1 1 13 1 13 1 12 1 1 11 1 1 10 1 10 1 9 1 1 8 1 1 7 1 1 6 1 6 1 5 1 5 1 4 1 1 3 1 3 1 2 1 2 1 1 1
result:
ok correct
Test #20:
score: 0
Accepted
time: 0ms
memory: 3980kb
input:
3532462
output:
75 1 2 2 3 4 6 6 7 8 10 10 11 12 14 14 15 16 16 18 19 21 21 22 23 23 25 26 28 28 29 30 30 32 33 35 35 36 37 39 39 40 41 41 43 44 44 46 47 49 49 50 51 53 53 54 55 57 57 58 59 61 61 62 63 63 65 66 68 68 69 70 70 72 73 21 21 1 20 1 20 1 19 1 19 1 18 1 18 1 17 1 1 16 1 16 1 15 1 1 14 1 14 1 13 1 1 12 1...
result:
ok correct
Test #21:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
54389236
output:
90 1 2 2 3 4 4 6 7 9 9 10 11 11 13 14 16 16 17 18 20 20 21 22 24 24 25 26 28 28 29 30 32 32 33 34 34 36 37 37 39 40 42 42 43 44 44 46 47 49 49 50 51 53 53 54 55 57 57 58 59 61 61 62 63 63 65 66 68 68 69 70 72 72 73 74 76 76 77 78 80 80 81 82 82 84 85 85 87 88 25 25 1 24 1 1 23 1 23 1 22 1 1 21 1 21...
result:
ok correct
Test #22:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
93453967
output:
89 1 1 2 3 3 5 6 6 8 9 9 11 12 14 14 15 16 16 18 19 19 21 22 24 24 25 26 26 28 29 31 31 32 33 35 35 36 37 39 39 40 41 43 43 44 45 47 47 48 49 51 51 52 53 55 55 56 57 59 59 60 61 61 63 64 64 66 67 67 69 70 72 72 73 74 74 76 77 77 79 80 82 82 83 84 86 86 87 26 1 25 1 1 24 1 1 23 1 1 22 1 22 1 21 1 1 ...
result:
ok correct
Test #23:
score: 0
Accepted
time: 0ms
memory: 3932kb
input:
1000000000
output:
98 1 2 2 3 4 4 6 7 7 9 10 10 12 13 13 15 16 16 18 19 19 21 22 22 24 25 25 27 28 30 30 31 32 32 34 35 37 37 38 39 39 41 42 42 44 45 47 47 48 49 51 51 52 53 53 55 56 58 58 59 60 60 62 63 65 65 66 67 69 69 70 71 71 73 74 74 76 77 79 79 80 81 83 83 84 85 87 87 88 89 89 91 92 94 94 95 96 29 29 1 28 1 1 ...
result:
ok correct
Test #24:
score: 0
Accepted
time: 0ms
memory: 3976kb
input:
999999999
output:
97 1 1 2 3 3 5 6 6 8 9 9 11 12 12 14 15 15 17 18 18 20 21 21 23 24 24 26 27 29 29 30 31 31 33 34 36 36 37 38 38 40 41 41 43 44 46 46 47 48 50 50 51 52 52 54 55 57 57 58 59 59 61 62 64 64 65 66 68 68 69 70 70 72 73 73 75 76 78 78 79 80 82 82 83 84 86 86 87 88 88 90 91 93 93 94 95 29 1 28 1 1 27 1 1 ...
result:
ok correct
Test #25:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
888888888
output:
103 1 2 2 3 4 4 6 7 7 9 10 12 12 13 14 16 16 17 18 20 20 21 22 22 24 25 25 27 28 28 30 31 33 33 34 35 37 37 38 39 41 41 42 43 45 45 46 47 47 49 50 52 52 53 54 54 56 57 59 59 60 61 63 63 64 65 65 67 68 70 70 71 72 74 74 75 76 78 78 79 80 82 82 83 84 86 86 87 88 88 90 91 91 93 94 96 96 97 98 98 100 10...
result:
ok correct
Test #26:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
333333334
output:
98 1 2 2 3 4 6 6 7 8 10 10 11 12 12 14 15 17 17 18 19 19 21 22 24 24 25 26 26 28 29 31 31 32 33 35 35 36 37 37 39 40 40 42 43 43 45 46 46 48 49 51 51 52 53 53 55 56 56 58 59 61 61 62 63 65 65 66 67 69 69 70 71 73 73 74 75 75 77 78 80 80 81 82 84 84 85 86 88 88 89 90 92 92 93 94 94 96 28 28 1 27 1 2...
result:
ok correct
Test #27:
score: 0
Accepted
time: 1ms
memory: 3820kb
input:
83495645
output:
90 1 1 2 3 5 5 6 7 9 9 10 11 13 13 14 15 17 17 18 19 19 21 22 24 24 25 26 28 28 29 30 30 32 33 35 35 36 37 37 39 40 42 42 43 44 44 46 47 47 49 50 50 52 53 53 55 56 56 58 59 61 61 62 63 63 65 66 68 68 69 70 72 72 73 74 76 76 77 78 80 80 81 82 84 84 85 86 86 88 26 1 25 1 25 1 24 1 24 1 23 1 23 1 22 1...
result:
ok correct
Test #28:
score: 0
Accepted
time: 0ms
memory: 3984kb
input:
894567865
output:
98 1 1 2 3 5 5 6 7 7 9 10 12 12 13 14 16 16 17 18 20 20 21 22 22 24 25 27 27 28 29 31 31 32 33 33 35 36 38 38 39 40 40 42 43 43 45 46 46 48 49 49 51 52 52 54 55 55 57 58 60 60 61 62 62 64 65 65 67 68 70 70 71 72 72 74 75 77 77 78 79 79 81 82 84 84 85 86 86 88 89 91 91 92 93 93 95 96 29 1 28 1 28 1 ...
result:
ok correct
Test #29:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
88479456
output:
87 1 2 2 3 4 4 6 7 7 9 10 10 12 13 13 15 16 18 18 19 20 22 22 23 24 26 26 27 28 28 30 31 33 33 34 35 37 37 38 39 39 41 42 44 44 45 46 46 48 49 49 51 52 52 54 55 55 57 58 60 60 61 62 64 64 65 66 66 68 69 69 71 72 72 74 75 77 77 78 79 79 81 82 84 84 85 26 26 1 25 1 1 24 1 1 23 1 1 22 1 1 21 1 21 1 20...
result:
ok correct
Test #30:
score: 0
Accepted
time: 0ms
memory: 3932kb
input:
1000000
output:
62 1 2 2 3 4 4 6 7 7 9 10 10 12 13 13 15 16 16 18 19 21 21 22 23 23 25 26 26 28 29 31 31 32 33 33 35 36 36 38 39 39 41 42 42 44 45 47 47 48 49 49 51 52 54 54 55 56 58 58 59 60 19 19 1 18 1 1 17 1 1 16 1 1 15 1 1 14 1 1 13 1 13 1 12 1 1 11 1 1 10 1 10 1 9 1 1 8 1 1 7 1 1 6 1 1 5 1 5 1 4 1 1 3 1 3 1 ...
result:
ok correct
Test #31:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
429085001
output:
94 1 1 2 3 5 5 6 7 7 9 10 12 12 13 14 14 16 17 17 19 20 22 22 23 24 24 26 27 29 29 30 31 31 33 34 34 36 37 37 39 40 42 42 43 44 44 46 47 49 49 50 51 51 53 54 56 56 57 58 60 60 61 62 62 64 65 65 67 68 70 70 71 72 72 74 75 75 77 78 80 80 81 82 84 84 85 86 86 88 89 89 91 92 28 1 27 1 27 1 26 1 1 25 1 ...
result:
ok correct
Test #32:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
882138811
output:
100 1 1 2 3 3 5 6 8 8 9 10 12 12 13 14 16 16 17 18 20 20 21 22 22 24 25 27 27 28 29 29 31 32 34 34 35 36 38 38 39 40 42 42 43 44 46 46 47 48 48 50 51 53 53 54 55 55 57 58 58 60 61 61 63 64 66 66 67 68 68 70 71 73 73 74 75 75 77 78 78 80 81 83 83 84 85 85 87 88 88 90 91 93 93 94 95 95 97 98 29 1 28 ...
result:
ok correct
Test #33:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
513157691
output:
96 1 1 2 3 3 5 6 8 8 9 10 12 12 13 14 16 16 17 18 20 20 21 22 22 24 25 25 27 28 28 30 31 33 33 34 35 35 37 38 40 40 41 42 42 44 45 47 47 48 49 49 51 52 52 54 55 55 57 58 60 60 61 62 64 64 65 66 66 68 69 71 71 72 73 73 75 76 76 78 79 81 81 82 83 83 85 86 88 88 89 90 92 92 93 94 28 1 27 1 1 26 1 26 1...
result:
ok correct
Test #34:
score: 0
Accepted
time: 0ms
memory: 3980kb
input:
813900859
output:
95 1 1 2 3 3 5 6 8 8 9 10 12 12 13 14 16 16 17 18 20 20 21 22 22 24 25 25 27 28 28 30 31 31 33 34 36 36 37 38 38 40 41 41 43 44 46 46 47 48 48 50 51 51 53 54 56 56 57 58 60 60 61 62 62 64 65 65 67 68 68 70 71 71 73 74 74 76 77 79 79 80 81 81 83 84 84 86 87 87 89 90 90 92 93 29 1 28 1 1 27 1 27 1 26...
result:
ok correct
Test #35:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
454848871
output:
95 1 1 2 3 3 5 6 6 8 9 11 11 12 13 13 15 16 18 18 19 20 22 22 23 24 24 26 27 29 29 30 31 31 33 34 34 36 37 37 39 40 42 42 43 44 46 46 47 48 50 50 51 52 52 54 55 55 57 58 58 60 61 63 63 64 65 67 67 68 69 71 71 72 73 73 75 76 76 78 79 79 81 82 84 84 85 86 88 88 89 90 90 92 93 28 1 27 1 1 26 1 1 25 1 ...
result:
ok correct
Test #36:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
151401319
output:
89 1 1 2 3 3 5 6 6 8 9 11 11 12 13 13 15 16 18 18 19 20 22 22 23 24 24 26 27 29 29 30 31 33 33 34 35 35 37 38 38 40 41 43 43 44 45 47 47 48 49 49 51 52 52 54 55 55 57 58 60 60 61 62 64 64 65 66 66 68 69 69 71 72 72 74 75 75 77 78 78 80 81 83 83 84 85 85 87 27 1 26 1 1 25 1 1 24 1 24 1 23 1 1 22 1 2...
result:
ok correct
Test #37:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
280898521
output:
97 1 1 2 3 5 5 6 7 7 9 10 12 12 13 14 16 16 17 18 18 20 21 23 23 24 25 27 27 28 29 31 31 32 33 35 35 36 37 37 39 40 42 42 43 44 44 46 47 49 49 50 51 51 53 54 54 56 57 57 59 60 62 62 63 64 66 66 67 68 70 70 71 72 74 74 75 76 78 78 79 80 80 82 83 85 85 86 87 87 89 90 90 92 93 93 95 28 1 27 1 27 1 26 ...
result:
ok correct
Test #38:
score: 0
Accepted
time: 0ms
memory: 3932kb
input:
412968047
output:
94 1 1 2 3 3 5 6 6 8 9 9 11 12 14 14 15 16 18 18 19 20 22 22 23 24 24 26 27 27 29 30 30 32 33 35 35 36 37 37 39 40 40 42 43 45 45 46 47 49 49 50 51 51 53 54 56 56 57 58 58 60 61 63 63 64 65 67 67 68 69 71 71 72 73 73 75 76 76 78 79 81 81 82 83 83 85 86 86 88 89 89 91 92 28 1 27 1 1 26 1 1 25 1 1 24...
result:
ok correct
Extra Test:
score: 0
Extra Test Passed