QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#864803 | #5647. Another Wine Tasting Event | juancs | WA | 0ms | 3584kb | C++20 | 2.0kb | 2025-01-21 08:39:43 | 2025-01-21 08:39:44 |
Judging History
answer
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef vector<int>vi;
typedef pair<int, int> ii;
typedef tree<int,null_type,less<int>, rb_tree_tag,
tree_order_statistics_node_update> ordered_set;
typedef long double ld;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
#define el '\n'
#define pb push_back
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
#define forn(i,n) for(int i = 0; i < n;++i)
#define for1(i, n) for(int i = 1; i <= n; ++i)
#define fore(i, l, r) for(int i = l; i <= r; ++i)
#define fored(i, l, r) for(int i = r; i >= l; --i)
#define pb push_back
#define db(x) cerr << #x << ' ' << x << el
void solve(){
int n, m;
cin >> n >> m;
vi a(m);
forn(i, m){
cin >> a[i];
}
vvvld dp(m, vvld(n+1, vld(n + 1)));
forn(i, m){
dp[i][0][a[i]] = 1;
}
int cy = 1;
while(cy <= n){
forn(i, m){
fore(j, a[i], n){
fore(k, j + 1, n){
dp[i][cy][k] += dp[i][cy - 1][j]*(1.0L/ld(n - j));
}
}
++a[i];
}
++cy;
}
vld ans(m);
vvvld suf = dp;
forn(i, m){
fored(yr, 1, n - 1){
suf[i][yr][n] += suf[i][yr + 1][n];
}
}
// forn(yr, n){
// for1(i, n){
// cout << dp[0][yr][i] << ' ';
// }
// cout << el;
// }
fore(yr, 1, n){
forn(i, m){
ld ys = 1;
forn(j, m){
if(i == j)continue;
ys *= suf[j][yr][n];
}
ans[i] += ys*dp[i][yr][n];
}
}
forn(i, m)cout << ans[i] << ' ';
cout << el;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.precision(20);
int tt = 1;
// cin>>tt;
while(tt--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3584kb
input:
5 RWWRRRWWW
output:
result:
wrong output format Unexpected end of file - int32 expected