結果
問題 | No.641 Team Contest Estimation |
ユーザー |
![]() |
提出日時 | 2019-02-08 15:58:46 |
言語 | C (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 840 bytes |
コンパイル時間 | 264 ms |
コンパイル使用メモリ | 32,256 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-28 09:52:23 |
合計ジャッジ時間 | 1,595 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 4 WA * 5 |
ソースコード
#include<stdio.h> #include<stdlib.h> #include<math.h> typedef long long int int64; const int mod=1000000009; int inv(int a){ int t=1; while(a>1){ t=(int64)t*(mod-mod/a)%mod; a=mod%a; } return t; } void run(void){ int n,k; scanf("%d%d",&n,&k); int cnt[61]={0}; for(int i=0;i<n;i++){ int64 a; scanf("%lld",&a); for(int j=0;j<k;j++){ cnt[j]+=a&1; a>>=1; } } int64 e=((1LL<<k)-1)%mod*inv(2)%mod*n%mod*((1LL<<k)%mod)%mod; printf("%lld\n",e); int64 v=0; for(int i=0;i<k;i++){ int64 prob=inv(2); int64 s=(1LL<<i)%mod; int64 x=s*cnt[i]%mod; int64 y=s*(n-cnt[i])%mod; int64 e2=prob*(x*x%mod+y*y%mod)%mod; v=(v+e2-prob*s%mod*n%mod*prob%mod*s%mod*n+mod)%mod; } for(int i=0;i<k;i++) v=4*v%mod; printf("%lld\n",v); } int main(void){ run(); return 0; }