結果
| 問題 | No.2561 みんな大好きmod 998 |
| コンテスト | |
| ユーザー |
Jikky1618
|
| 提出日時 | 2025-09-03 07:49:47 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 250 ms / 4,000 ms |
| コード長 | 870 bytes |
| 記録 | |
| コンパイル時間 | 3,218 ms |
| コンパイル使用メモリ | 278,720 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-09-03 07:49:55 |
| 合計ジャッジ時間 | 7,355 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 44 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef LOCAL
#include <debug.hpp>
#else
#define debug(...)
#endif
int next_conbination(int sub) {
assert(sub > 0);
int t = sub | (sub - 1);
return (t + 1) | (((~t & -~t) - 1) >> (__builtin_ctz(sub) + 1));
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(20);
int N, K;
cin >> N >> K;
vector<int> A(N);
for (int i = 0; i < N; i++) cin >> A[i];
int ans = 0;
for (int bit = (1 << K) - 1; bit < (1 << N); bit = next_conbination(bit)) {
ll S998 = 0, S998244353 = 0;
for (int i = 0; i < N; i++) {
if ((bit >> i) & 1) S998 += A[i], S998244353 += A[i];
}
S998 %= 998, S998244353 %= 998244353;
if (S998244353 <= S998) ans++;
}
cout << ans % 998 << '\n';
}
Jikky1618