結果

問題 No.2561 みんな大好きmod 998
ユーザー yumekawayuiyumekawayui
提出日時 2023-12-02 14:49:32
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 312 ms / 4,000 ms
コード長 1,394 bytes
コンパイル時間 4,325 ms
コンパイル使用メモリ 187,504 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-02 14:49:48
合計ジャッジ時間 8,928 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 12 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 312 ms
6,676 KB
testcase_04 AC 282 ms
6,676 KB
testcase_05 AC 282 ms
6,676 KB
testcase_06 AC 281 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 42 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 2 ms
6,676 KB
testcase_14 AC 2 ms
6,676 KB
testcase_15 AC 280 ms
6,676 KB
testcase_16 AC 2 ms
6,676 KB
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 2 ms
6,676 KB
testcase_19 AC 194 ms
6,676 KB
testcase_20 AC 2 ms
6,676 KB
testcase_21 AC 1 ms
6,676 KB
testcase_22 AC 2 ms
6,676 KB
testcase_23 AC 2 ms
6,676 KB
testcase_24 AC 1 ms
6,676 KB
testcase_25 AC 1 ms
6,676 KB
testcase_26 AC 58 ms
6,676 KB
testcase_27 AC 282 ms
6,676 KB
testcase_28 AC 79 ms
6,676 KB
testcase_29 AC 21 ms
6,676 KB
testcase_30 AC 64 ms
6,676 KB
testcase_31 AC 138 ms
6,676 KB
testcase_32 AC 36 ms
6,676 KB
testcase_33 AC 22 ms
6,676 KB
testcase_34 AC 282 ms
6,676 KB
testcase_35 AC 22 ms
6,676 KB
testcase_36 AC 22 ms
6,676 KB
testcase_37 AC 10 ms
6,676 KB
testcase_38 AC 42 ms
6,676 KB
testcase_39 AC 63 ms
6,676 KB
testcase_40 AC 63 ms
6,676 KB
testcase_41 AC 43 ms
6,676 KB
testcase_42 AC 79 ms
6,676 KB
testcase_43 AC 10 ms
6,676 KB
testcase_44 AC 30 ms
6,676 KB
testcase_45 AC 195 ms
6,676 KB
testcase_46 AC 29 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/extc++.h>
using namespace std;
using ld = long double; 
const vector<int> dx = {0, 0, 1, -1};
const vector<int> dy = {1, -1, 0, 0};
#define vec vector
#define int long long
#define double long double
//cout<<setprecision(10)<<fixed<<..
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repp(i, x, n) for (int i = x; i < (int)(n); i++)
#define pii pair<int,int>
#define pq priority_queue
#define all(V) begin(V),end(V)
#define printpair(p) cout<<p.first<<" "<<p.second<<"\n"
#define tple tuple<int,int,int>
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }
#define mend(a,b) G[a].push_back(b)

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n,k;cin>>n>>k;
    vec<int> A(n);
    int m=998;
    rep(i,n){cin>>A[i];}
    vec<bool> Z(n,false);
    rep(i,k){Z[i]=true;}
    sort(all(Z));
    int ans=0;
    do{
        int cur=0;
        rep(i,n){
            if(Z[i]){
                cur+=A[i];
            }
        }
        if(cur%998>=cur%998244353){
            ans++;
            ans%=998;
        }
    }while(next_permutation(all(Z)));
    cout<<ans<<"\n";

}
0