QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#799266 | #667. Randomized Binary Search Tree | Kazemaru | TL | 1ms | 3984kb | C++17 | 442b | 2024-12-05 09:47:14 | 2024-12-05 09:47:14 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define f(i,j,k) for(int i=j;i<=k;++i)
#define g(i,j,k) for(int i=j;i>=k;--i)
int n,m,s,l;
const int N=5e4,V=1e6;
int f[N],g[N],h[N];
signed main(){
cin>>n;f[0]=1e6;
f(p,1,n){
if(p>50){h[p]=f[0];continue;}
f(i,0,n)f(j,0,n-i)g[i+j]+=f[i]*f[j];
f(i,1,n)f[i]=g[i-1]/i/V,g[i-1]=0;h[p]=f[n];
}
f(p,1,n)printf("%.5lf\n",(h[p]-h[p-1])*1.0/V);
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3976kb
input:
1
output:
1.00000
result:
ok found '1.00000', expected '1.00000', error '0.00000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
2
output:
0.00000 1.00000
result:
ok 2 numbers
Test #3:
score: 0
Accepted
time: 0ms
memory: 3932kb
input:
3
output:
0.00000 0.33333 0.66667
result:
ok 3 numbers
Test #4:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
4
output:
0.00000 0.00000 0.66667 0.33333
result:
ok 4 numbers
Test #5:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
5
output:
0.00000 0.00000 0.33333 0.53333 0.13333
result:
ok 5 numbers
Test #6:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
6
output:
0.00000 0.00000 0.11111 0.55556 0.28889 0.04444
result:
ok 6 numbers
Test #7:
score: 0
Accepted
time: 0ms
memory: 3984kb
input:
7
output:
0.00000 0.00000 0.01587 0.44444 0.40635 0.12064 0.01270
result:
ok 7 numbers
Test #8:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
8
output:
0.00000 0.00000 0.00000 0.28175 0.46667 0.20714 0.04127 0.00317
result:
ok 8 numbers
Test #9:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
9
output:
0.00000 0.00000 0.00000 0.15168 0.46508 0.28783 0.08272 0.01199 0.00071
result:
ok 9 numbers
Test #10:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
10
output:
0.00000 0.00000 0.00000 0.06984 0.41557 0.35206 0.13201 0.02734 0.00303 0.00014
result:
ok 10 numbers
Test #11:
score: -100
Time Limit Exceeded
input:
30000