結果

問題 No.641 Team Contest Estimation
ユーザー akakimidoriakakimidori
提出日時 2019-02-08 15:58:46
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 840 bytes
コンパイル時間 725 ms
コンパイル使用メモリ 30,968 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-10 18:41:50
合計ジャッジ時間 2,202 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 WA -
testcase_02 AC 0 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 0 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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