結果

問題 No.2561 みんな大好きmod 998
ユーザー 沙耶花沙耶花
提出日時 2023-12-06 00:24:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 254 ms / 4,000 ms
コード長 579 bytes
コンパイル時間 4,405 ms
コンパイル使用メモリ 261,624 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-06 00:24:25
合計ジャッジ時間 9,349 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 11 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 254 ms
6,676 KB
testcase_04 AC 240 ms
6,676 KB
testcase_05 AC 242 ms
6,676 KB
testcase_06 AC 245 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 39 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 242 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 176 ms
6,676 KB
testcase_20 AC 2 ms
6,676 KB
testcase_21 AC 2 ms
6,676 KB
testcase_22 AC 2 ms
6,676 KB
testcase_23 AC 2 ms
6,676 KB
testcase_24 AC 2 ms
6,676 KB
testcase_25 AC 2 ms
6,676 KB
testcase_26 AC 54 ms
6,676 KB
testcase_27 AC 241 ms
6,676 KB
testcase_28 AC 73 ms
6,676 KB
testcase_29 AC 20 ms
6,676 KB
testcase_30 AC 59 ms
6,676 KB
testcase_31 AC 125 ms
6,676 KB
testcase_32 AC 32 ms
6,676 KB
testcase_33 AC 21 ms
6,676 KB
testcase_34 AC 242 ms
6,676 KB
testcase_35 AC 20 ms
6,676 KB
testcase_36 AC 20 ms
6,676 KB
testcase_37 AC 10 ms
6,676 KB
testcase_38 AC 40 ms
6,676 KB
testcase_39 AC 58 ms
6,676 KB
testcase_40 AC 60 ms
6,676 KB
testcase_41 AC 40 ms
6,676 KB
testcase_42 AC 73 ms
6,676 KB
testcase_43 AC 10 ms
6,676 KB
testcase_44 AC 28 ms
6,676 KB
testcase_45 AC 177 ms
6,676 KB
testcase_46 AC 25 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001

int main(){
	
	int N,K;
	cin>>N>>K;
	vector<int> t(N,1);
	rep(i,N-K)t[i] = 0;
	long long ans = 0;
	vector<long long> a(N);
	rep(i,N)cin>>a[i];
	
	do{
		long long sum = 0;
		rep(i,N){
			if(t[i])sum += a[i];
		}
		if(sum%998244353<=sum%998)ans++;
	}
	while(next_permutation(t.begin(),t.end()));
	cout<<ans%998<<endl;
	return 0;
}
0