結果

問題 No.766 金魚すくい
ユーザー chocoruskchocorusk
提出日時 2018-12-14 00:40:35
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,303 bytes
コンパイル時間 886 ms
コンパイル使用メモリ 100,012 KB
実行使用メモリ 7,332 KB
最終ジャッジ日時 2023-10-25 09:45:17
合計ジャッジ時間 3,541 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
7,332 KB
testcase_01 AC 4 ms
7,332 KB
testcase_02 AC 4 ms
7,332 KB
testcase_03 AC 4 ms
7,332 KB
testcase_04 AC 4 ms
7,332 KB
testcase_05 AC 5 ms
7,332 KB
testcase_06 AC 4 ms
7,332 KB
testcase_07 AC 4 ms
7,332 KB
testcase_08 AC 5 ms
7,332 KB
testcase_09 AC 4 ms
7,332 KB
testcase_10 AC 5 ms
7,332 KB
testcase_11 AC 4 ms
7,332 KB
testcase_12 AC 4 ms
7,332 KB
testcase_13 AC 5 ms
7,332 KB
testcase_14 AC 5 ms
7,332 KB
testcase_15 AC 5 ms
7,332 KB
testcase_16 AC 5 ms
7,332 KB
testcase_17 AC 5 ms
7,332 KB
testcase_18 AC 5 ms
7,332 KB
testcase_19 AC 5 ms
7,332 KB
testcase_20 AC 5 ms
7,332 KB
testcase_21 AC 5 ms
7,332 KB
testcase_22 AC 5 ms
7,332 KB
testcase_23 WA -
testcase_24 AC 67 ms
7,332 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 60 ms
7,332 KB
testcase_34 AC 60 ms
7,332 KB
testcase_35 AC 5 ms
7,332 KB
testcase_36 AC 6 ms
7,332 KB
testcase_37 AC 68 ms
7,332 KB
testcase_38 AC 67 ms
7,332 KB
testcase_39 AC 69 ms
7,332 KB
testcase_40 AC 65 ms
7,332 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 4 ms
7,332 KB
testcase_44 AC 4 ms
7,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;
ll powmod(ll a, ll k){
    ll ap=a, ans=1;
    while(k>0){
        if(k%2==1){
            ans*=ap;
            ans%=MOD;
        }
        ap=ap*ap;
        ap%=MOD;
        k/=2;
    }
    return ans;
}
ll inv(ll a){
	return powmod(a, MOD-2);
}
int main()
{
	int n, m; ll p;
	cin>>n>>m>>p;
	p=p*inv(100ll)%MOD;
	ll f[100001]; f[0]=1;
	for(ll i=1; i<=m+n; i++) f[i]=f[i-1]*i%MOD;
	ll invf[200001];
	invf[m+n]=inv(f[m+n]);
	for(ll i=m+n-1; i>=0; i--) invf[i]=invf[i+1]*(i+1)%MOD;
	ll s[100001]; s[0]=0;
	ll v[100001];
	for(int i=0; i<n; i++){
		cin>>v[i];
	}
	sort(v, v+n, greater<ll>());
	for(int i=0; i<n; i++) s[i+1]=(s[i]+v[i])%MOD;
	ll ans=0;
	ll ps=0;
	for(int i=0; i<=n-1; i++){
		ll q=f[i+m-1]*invf[i]%MOD*invf[m-1]%MOD*powmod((1-p+MOD)%MOD, (ll)i)%MOD*powmod(p, (ll)m)%MOD;
		ps=(ps+q)%MOD;
		ans+=(q*s[i]%MOD);
		ans%=MOD;
	}
	ans+=((1-ps+MOD)%MOD*s[n]%MOD);
	ans%=MOD;
	cout<<ans<<endl;
	return 0;
}
0