QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#864803#5647. Another Wine Tasting EventjuancsWA 0ms3584kbC++202.0kb2025-01-21 08:39:432025-01-21 08:39:44

Judging History

你现在查看的是最新测评结果

  • [2025-01-21 08:39:44]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3584kb
  • [2025-01-21 08:39:43]
  • 提交

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;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3584kb

input:

5
RWWRRRWWW

output:



result:

wrong output format Unexpected end of file - int32 expected