結果

問題 No.641 Team Contest Estimation
ユーザー square1001square1001
提出日時 2018-01-21 14:00:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 600 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 37,728 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-26 19:33:55
合計ジャッジ時間 1,488 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 26 ms
4,376 KB
testcase_06 AC 26 ms
4,376 KB
testcase_07 AC 26 ms
4,376 KB
testcase_08 AC 25 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,376 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