QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#65190#4228. Double SortSorting#WA 3ms5592kbC++950b2022-11-28 00:10:182022-11-28 00:10:21

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-28 00:10:21]
  • Judged
  • Verdict: WA
  • Time: 3ms
  • Memory: 5592kb
  • [2022-11-28 00:10:18]
  • Submitted

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<=n ;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: 3ms
memory: 5592kb

input:

3 5

output:

1.0000000000
2.3000000000
4.5000000000

result:

ok 3 numbers

Test #2:

score: -100
Wrong Answer
time: 3ms
memory: 5576kb

input:

5 17

output:

1.1313833226
2.7483839690
5.1830963154
8.8540723982
14.2533936652

result:

wrong answer 4th numbers differ - expected: '8.8556884', found: '8.8540724', error = '0.0001825'