結果

問題 No.641 Team Contest Estimation
ユーザー square1001square1001
提出日時 2018-01-19 21:43:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 596 bytes
コンパイル時間 234 ms
コンパイル使用メモリ 37,776 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-26 19:34:10
合計ジャッジ時間 1,019 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cmath>
#include <cstdio>
#define sqr(x) (x * x % mod)
int N, K, c[66], mod = 1000000009; long long a;
int main() {
	scanf("%d%d", &N, &K);
	for (int i = 0; i < N; i++) {
		scanf("%lld", &a);
		for (int j = 0; j < K; j++) c[j] += (a >> j) & 1;
	}
	int var = 0, pw = 1;
	for (int i = 0; i < K; i++) var = (var + sqr(1LL * abs(N - c[i] * 2) * ((1LL << i) % mod) % mod)) % mod;
	for (int i = 1; i < K; i++) pw = 4LL * pw % mod;
	printf("%d\n", (int)(K == 0 ? 0 : (1LL << (K - 1)) % mod * (((1LL << K) - 1) % mod) % mod * N % mod));
	printf("%d\n", (int)(1LL * var * pw % mod));
	return 0;
}
0