結果

問題 No.2561 みんな大好きmod 998
ユーザー takashin9
提出日時 2023-12-07 19:38:50
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 476 bytes
コンパイル時間 1,731 ms
コンパイル使用メモリ 171,060 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-27 02:18:47
合計ジャッジ時間 5,669 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 42 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
	int n, k; cin >> n >> k;
	ll ans = 0;
	vector<ll> a(n), c;
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < n - k; i++) c.push_back(0);
	for (int i = 0; i < k; i++) c.push_back(1);
	do {
		ll cnt = 0;
		for (int i = 0; i < n; i++) {
			if (c[i]) cnt += a[i];
		}
		if (cnt % 998244353 < cnt % 998) ans++;
	} while (next_permutation(begin(c), end(c)));
	cout << ans % 998 << endl;
}
0