結果

問題 No.641 Team Contest Estimation
ユーザー e869120e869120
提出日時 2018-01-26 23:01:36
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 827 bytes
コンパイル時間 548 ms
コンパイル使用メモリ 65,436 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-27 19:37:06
合計ジャッジ時間 2,062 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
using namespace std;

long long N, K, A[100009], sigma, sum, mod = 1000000009;

int main() {
	cin >> N >> K;
	for (int i = 1; i <= N; i++) cin >> A[i];
	for (int i = 0; i < K; i++) {
		long long P1 = 0, P2 = 0;
		for (int j = 1; j <= N; j++) {
			if ((A[j] / (1LL << i)) % 2 == 0) P1 += (1LL << i);
			else P2 += (1LL << i);
		}
		long long S1 = sigma + ((1LL << i) % mod)*((P1*P1) % mod) + (2LL * P1*sum); S1 %= mod;
		long long S2 = sigma + ((1LL << i) % mod)*((P2*P2) % mod) + (2LL * P2*sum); S2 %= mod;
		long long T = sum * 2LL; T += ((1LL << i) % mod)*(P1 + P2); T %= mod;
		sigma = S1 + S2; sigma %= mod; sum = T;
	}
	cout << sum << endl;
	long long ans = sigma;
	for (int i = 0; i < K; i++) { ans *= 2; ans %= mod; }
	ans = ans - (sum*sum) % mod + mod; ans %= mod;
	cout << ans << endl;
	return 0;
}
0