QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#65191 | #4228. Double Sort | Sorting# | WA | 38ms | 19500kb | C++ | 950b | 2022-11-28 00:12:41 | 2022-11-28 00:12:43 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
typedef long double ld;
int n,m;
ld C[10001][51];
ld f[10001][51];
ld e[51];
int main(){
ios::sync_with_stdio(false);cin.tie(0);
cin >> n >> m;
C[0][0]=1;
for(int i=1; i<=m ;i++){
C[i][0]=1;
for(int j=1; j<=n ;j++){
C[i][j]=C[i-1][j-1]+C[i-1][j];
}
}
for(int i=1; i<=m ;i++){
for(int k=n; k>=1 ;k--){
ld king=0;
if(m>=i*k+n) king=C[m-i*k][n]/C[m][n]*C[n][k];
//cout << i << " " << k << ' ' << king << endl;
for(int j=k+1; j<=n ;j++){
king-=f[i][j]*C[j][k];
}
f[i][k]=king;
//cout << i << ' ' << k << ' ' << king << endl;
}
}
for(int j=1; j<=n ;j++){
for(int i=1; i<=m ;i++){
for(int k=n-j+1; k<=n ;k++){
e[j]+=f[i][k];
}
}
e[j]+=1;
}
cout << fixed << setprecision(10);
for(int j=1; j<=n ;j++){
e[j]+=e[j-1];
cout << e[j] << '\n';
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 5660kb
input:
3 5
output:
1.0000000000 2.3000000000 4.5000000000
result:
ok 3 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 5528kb
input:
5 17
output:
1.1313833226 2.7483839690 5.1830963154 8.8556884292 15.0000000000
result:
ok 5 numbers
Test #3:
score: -100
Wrong Answer
time: 38ms
memory: 19500kb
input:
50 10000
output:
4.4328164335 12.8365968668 25.3152687339 41.9556112383 62.8480760618 88.0871546758 117.7716337788 152.0048947780 190.8952420024 234.5562629337 283.1072243187 336.6735099489 395.3870978163 459.3871209121 528.8204151538 603.8417567781 684.6198637125 771.3036689855 864.1899783271 963.0871833245 1069.28...
result:
wrong answer 17th numbers differ - expected: '684.6168328', found: '684.6198637', error = '0.0000044'