結果

問題 No.641 Team Contest Estimation
ユーザー Lepton_sLepton_s
提出日時 2018-01-27 14:52:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 629 bytes
コンパイル時間 448 ms
コンパイル使用メモリ 51,644 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-28 09:53:59
合計ジャッジ時間 1,675 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cmath>
#include <cstdio>
using namespace std;
typedef long long ll;
const ll mod = 1e9+9;
#define REP(i,a,b) for(ll (i)=a;(i)<(ll)(b);++(i))
#define rep(i,n) REP(i,0,n)

ll a[100000];
ll t[61], tt[61];

int main(){
	ll n, k;
	scanf("%lld%lld", &n, &k);
	t[0] = 1;
	rep(i, k) t[i+1] = t[i]*2%mod;
	rep(i, k+1) tt[i] = t[i]*t[i]%mod;
	rep(i, n) scanf("%lld", a+i);
	ll mu = t[k-1]*(t[k]-1)%mod*n%mod;
	ll sg = 0;
	rep(i, k){
		ll cnt = 0;
		rep(j, n) if(1&(a[j]>>i)) cnt++;
		ll df = abs(n-2*cnt);
		(df*=df)%=mod;
		(df*=tt[i])%=mod;
		(df*=tt[k-1])%=mod;
		(sg+=df);
	}
	printf("%lld\n%lld\n", mu, sg%mod);
	return 0;
}
0