結果

問題 No.2561 みんな大好きmod 998
ユーザー a01sa01toa01sa01to
提出日時 2023-12-02 14:40:43
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,463 ms / 4,000 ms
コード長 585 bytes
コンパイル時間 2,695 ms
コンパイル使用メモリ 247,288 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-02 14:41:15
合計ジャッジ時間 21,932 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 14 ms
6,676 KB
testcase_02 AC 1 ms
6,676 KB
testcase_03 AC 1,443 ms
6,676 KB
testcase_04 AC 1,451 ms
6,676 KB
testcase_05 AC 1,406 ms
6,676 KB
testcase_06 AC 1,422 ms
6,676 KB
testcase_07 AC 151 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 3 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 201 ms
6,676 KB
testcase_12 AC 1 ms
6,676 KB
testcase_13 AC 39 ms
6,676 KB
testcase_14 AC 77 ms
6,676 KB
testcase_15 AC 1,437 ms
6,676 KB
testcase_16 AC 155 ms
6,676 KB
testcase_17 AC 1 ms
6,676 KB
testcase_18 AC 3 ms
6,676 KB
testcase_19 AC 756 ms
6,676 KB
testcase_20 AC 11 ms
6,676 KB
testcase_21 AC 2 ms
6,676 KB
testcase_22 AC 2 ms
6,676 KB
testcase_23 AC 3 ms
6,676 KB
testcase_24 AC 2 ms
6,676 KB
testcase_25 AC 1 ms
6,676 KB
testcase_26 AC 354 ms
6,676 KB
testcase_27 AC 1,445 ms
6,676 KB
testcase_28 AC 696 ms
6,676 KB
testcase_29 AC 55 ms
6,676 KB
testcase_30 AC 121 ms
6,676 KB
testcase_31 AC 427 ms
6,676 KB
testcase_32 AC 1,224 ms
6,676 KB
testcase_33 AC 53 ms
6,676 KB
testcase_34 AC 1,463 ms
6,676 KB
testcase_35 AC 346 ms
6,676 KB
testcase_36 AC 314 ms
6,676 KB
testcase_37 AC 46 ms
6,676 KB
testcase_38 AC 182 ms
6,676 KB
testcase_39 AC 128 ms
6,676 KB
testcase_40 AC 124 ms
6,676 KB
testcase_41 AC 195 ms
6,676 KB
testcase_42 AC 699 ms
6,676 KB
testcase_43 AC 47 ms
6,676 KB
testcase_44 AC 98 ms
6,676 KB
testcase_45 AC 775 ms
6,676 KB
testcase_46 AC 623 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
  #include "settings/debug.cpp"
  #define _GLIBCXX_DEBUG
#else
  #define Debug(...) void(0)
#endif
using ll = long long;
using ull = unsigned long long;
#define rep(i, n) for (int i = 0; i < (n); ++i)

int main() {
  int n,k;cin>>n>>k;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  int ans = 0;
  rep(bit, 1 << n) {
    if (popcount(ull(bit)) != k) continue;
    ll sum = 0;
    rep(i,n) {
      if (bit & (1 << i))  sum += a[i];
    }
    if (sum % 998244353 <= sum % 998) ans++;
  }
  cout << ans % 998 << endl;
  return 0;
}
0