結果

問題 No.2561 みんな大好きmod 998
ユーザー MagentorMagentor
提出日時 2023-10-26 22:42:55
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 227 ms / 4,000 ms
コード長 2,445 bytes
コンパイル時間 6,757 ms
コンパイル使用メモリ 334,060 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-11-05 13:19:28
合計ジャッジ時間 10,649 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 11 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 227 ms
4,348 KB
testcase_04 AC 227 ms
4,348 KB
testcase_05 AC 225 ms
4,348 KB
testcase_06 AC 226 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 33 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 227 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 158 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 47 ms
4,348 KB
testcase_27 AC 227 ms
4,348 KB
testcase_28 AC 62 ms
4,348 KB
testcase_29 AC 19 ms
4,348 KB
testcase_30 AC 56 ms
4,348 KB
testcase_31 AC 111 ms
4,348 KB
testcase_32 AC 28 ms
4,348 KB
testcase_33 AC 19 ms
4,348 KB
testcase_34 AC 227 ms
4,348 KB
testcase_35 AC 17 ms
4,348 KB
testcase_36 AC 18 ms
4,348 KB
testcase_37 AC 9 ms
4,348 KB
testcase_38 AC 34 ms
4,348 KB
testcase_39 AC 56 ms
4,348 KB
testcase_40 AC 57 ms
4,348 KB
testcase_41 AC 34 ms
4,348 KB
testcase_42 AC 62 ms
4,348 KB
testcase_43 AC 8 ms
4,348 KB
testcase_44 AC 26 ms
4,348 KB
testcase_45 AC 158 ms
4,348 KB
testcase_46 AC 22 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <atcoder/all>
using namespace atcoder;
template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); }
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep2(i, m ,n) for (int i = (m); i < (long long)(n); i++)
#define REP(i, n) for (long long i = 1; i < (long long)(n); i++)
typedef long long ll;
#define updiv(N,X) (N + X - 1) / X
#define l(n) n.begin(),n.end()
#define YesNo(Q) Q==1?cout<<"Yes":cout<<"No"
using P = pair<int, int>;
using mint = modint;
const int MOD = 1000000007LL;
const ll INF = 999999999999LL;
vector<long long> fact, fact_inv, inv;
/*  init_nCk :二項係数のための前処理
    計算量:O(n)
*/
template <typename T>
void input(vector<T> &v){
 rep(i,v.size()){cin>>v[i];}
  return;
}
void init_nCk(int SIZE) {
    fact.resize(SIZE + 5);
    fact_inv.resize(SIZE + 5);
    inv.resize(SIZE + 5);
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < SIZE + 5; i++) {
        fact[i] = fact[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD;
    }
}
/*  nCk :MODでの二項係数を求める(前処理 int_nCk が必要)
    計算量:O(1)
*/
long long nCk(int n, int k) {
    if(n < k){return 1;}
    if(n < 0 || k < 0){return 1;}
    return fact[n] * (fact_inv[k] * fact_inv[n - k] % MOD) % MOD;
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

ll POW(ll a,ll n){
  long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a;
        a = a * a;
        n >>= 1;
    }
    return res;
}
mint cum[4];
bool fcomp(const pair<ll,ll>& a, const pair<ll,ll>& b) { return a.first*b.second > b.first*a.second; }
int main() {
ll n,k;cin>>n>>k;
vector<ll> v(n);rep(i,n){cin>>v[i];}
vector<int> t(n-k,0);rep(i,k){t.push_back(1);}
ll res = 0;
do{
ll a = 0;ll b = 0;
rep(i,n){
	///cout<<t[i];
	if(t[i]==1){a += v[i];b += v[i];a %= 998;b %= 998244353;}}
if(b<=a){res++;}
}while(next_permutation(l(t)));
cout << res%998 << endl;
}
0