結果
| 問題 | No.2561 みんな大好きmod 998 |
| コンテスト | |
| ユーザー |
shisidor
|
| 提出日時 | 2023-12-02 15:57:49 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ac-library) |
| 結果 |
AC
不安定
|
| 実行時間 | 866 ms / 4,000 ms |
| + 28µs | |
| コード長 | 676 bytes |
| 記録 | |
| コンパイル時間 | 350 ms |
| コンパイル使用メモリ | 90,548 KB |
| 実行使用メモリ | 9,784 KB |
| 最終ジャッジ日時 | 2026-09-05 01:32:35 |
| 合計ジャッジ時間 | 13,053 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 44 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
#include<bitset>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<long long> a(n);
for (int i = 0; i < n; i++) cin >> a[i];
int m1 = 998, m2 = 998244353;
long long res = 0;
for (long long i = 0; i < (1LL << n); i++) {
bitset<28> I(i);
//cout << I << endl;
if (I.count() != k) continue;
//cout << I << endl;
long long sum = 0;
for (int j = 0; j < n; j++) {
if (I.test(j)) sum += a[j];
}
//cout << sum << endl;
if (sum % m2 <= sum % m1) res++;
}
res %= 998;
cout << res << endl;
}
shisidor