結果
問題 |
No.2561 みんな大好きmod 998
|
ユーザー |
|
提出日時 | 2023-12-07 19:08:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 240 ms / 4,000 ms |
コード長 | 782 bytes |
コンパイル時間 | 1,824 ms |
コンパイル使用メモリ | 173,456 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-27 02:17:42 |
合計ジャッジ時間 | 5,853 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 44 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; using T = tuple<ll, ll, ll>; // #include <atcoder/all> // using namespace atcoder; // using mint = modint1000000007; #define rep(i, n) for(ll i = 0; i < n; i++) int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); ll n, k; cin >> n >> k; ll mod = 998; vector<ll> a(n); rep(i,n) cin >> a[i]; vector<ll> p; rep(i,k) p.emplace_back(1); while( p.size() < n ) p.emplace_back(0); sort(p.begin(), p.end()); ll ans = 0; do { ll sum = 0; rep(i,n) if( p[i] ) sum += a[i]; if( sum%998 >= sum%998244353 ) ans++; } while(next_permutation(p.begin(), p.end())); cout << ans%998 << endl; return 0; }