結果

問題 No.2561 みんな大好きmod 998
コンテスト
ユーザー takashin9
提出日時 2023-12-07 19:38:50
言語 C++14
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 476 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 851 ms
コンパイル使用メモリ 187,480 KB
実行使用メモリ 9,788 KB
最終ジャッジ日時 2026-09-05 03:26:59
合計ジャッジ時間 5,302 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 42 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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