結果
| 問題 | No.2561 みんな大好きmod 998 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-12-07 22:03:02 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 230 ms / 4,000 ms |
| コード長 | 477 bytes |
| 記録 | |
| コンパイル時間 | 1,689 ms |
| コンパイル使用メモリ | 171,868 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-27 02:22:30 |
| 合計ジャッジ時間 | 5,589 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 44 |
ソースコード
#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;
}