結果
問題 | No.2561 みんな大好きmod 998 |
ユーザー |
![]() |
提出日時 | 2024-04-04 07:18:20 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 327 ms / 4,000 ms |
コード長 | 724 bytes |
コンパイル時間 | 4,458 ms |
コンパイル使用メモリ | 253,564 KB |
最終ジャッジ日時 | 2025-02-20 20:00:12 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 44 |
ソースコード
#include <atcoder/all>#include <bits/stdc++.h>using namespace std;using namespace atcoder;typedef long long ll;void solve() {ll n , k;cin >> n >> k;vector<ll> A(n);for (ll i = 0; i < n; ++i) cin >> A[i];vector<ll> SE(n,0);for (ll i = 0; i < k; ++i) SE[i] = 1;sort(SE.begin(), SE.end());static_modint<998> ans = 0;do {modint998244353 tmpa = 0;static_modint<998> tmpb = 0;for (ll i = 0; i < n; ++i) {if (SE[i]==1) tmpa += A[i],tmpb += A[i];}if (tmpa.val() <= tmpb.val()) ++ans;} while (next_permutation(SE.begin(), SE.end()));cout << ans.val() << endl;}int main() {solve();return 0;}