結果

問題 No.2561 みんな大好きmod 998
ユーザー k82bk82b
提出日時 2023-12-02 14:50:31
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 386 ms / 4,000 ms
コード長 1,023 bytes
コンパイル時間 4,216 ms
コンパイル使用メモリ 165,620 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-02 14:50:44
合計ジャッジ時間 7,836 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 15 ms
6,676 KB
testcase_02 AC 1 ms
6,676 KB
testcase_03 AC 370 ms
6,676 KB
testcase_04 AC 375 ms
6,676 KB
testcase_05 AC 377 ms
6,676 KB
testcase_06 AC 376 ms
6,676 KB
testcase_07 AC 1 ms
6,676 KB
testcase_08 AC 1 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 58 ms
6,676 KB
testcase_12 AC 1 ms
6,676 KB
testcase_13 AC 1 ms
6,676 KB
testcase_14 AC 2 ms
6,676 KB
testcase_15 AC 386 ms
6,676 KB
testcase_16 AC 1 ms
6,676 KB
testcase_17 AC 1 ms
6,676 KB
testcase_18 AC 1 ms
6,676 KB
testcase_19 AC 261 ms
6,676 KB
testcase_20 AC 1 ms
6,676 KB
testcase_21 AC 1 ms
6,676 KB
testcase_22 AC 1 ms
6,676 KB
testcase_23 AC 1 ms
6,676 KB
testcase_24 AC 1 ms
6,676 KB
testcase_25 AC 1 ms
6,676 KB
testcase_26 AC 81 ms
6,676 KB
testcase_27 AC 375 ms
6,676 KB
testcase_28 AC 108 ms
6,676 KB
testcase_29 AC 29 ms
6,676 KB
testcase_30 AC 86 ms
6,676 KB
testcase_31 AC 185 ms
6,676 KB
testcase_32 AC 49 ms
6,676 KB
testcase_33 AC 29 ms
6,676 KB
testcase_34 AC 373 ms
6,676 KB
testcase_35 AC 29 ms
6,676 KB
testcase_36 AC 30 ms
6,676 KB
testcase_37 AC 14 ms
6,676 KB
testcase_38 AC 58 ms
6,676 KB
testcase_39 AC 86 ms
6,676 KB
testcase_40 AC 86 ms
6,676 KB
testcase_41 AC 58 ms
6,676 KB
testcase_42 AC 109 ms
6,676 KB
testcase_43 AC 13 ms
6,676 KB
testcase_44 AC 41 ms
6,676 KB
testcase_45 AC 266 ms
6,676 KB
testcase_46 AC 38 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std, core.bitop;
string[] _R;
void readM(T)(ref T x) { while (_R.empty) { _R = readln.chomp.split; } x = _R.front.to!T; _R.popFront; }
bool chmin(T)(ref T A, T B) { if (A > B) { A = B; return true; } else { return false; } }
bool chmax(T)(ref T A, T B) { if (A < B) { A = B; return true; } else { return false; } }
int lowerBound(T)(T[] A, T x) { int lo = -1, hi = cast(int)(A.length); while (hi - lo > 1) { int mid = lo + hi >> 1; (A[mid] < x ? lo : hi) = mid; } return hi; }
int upperBound(T)(T[] A, T x) { int lo = -1, hi = cast(int)(A.length); while (hi - lo > 1) { int mid = lo + hi >> 1; (A[mid] > x ? hi : lo) = mid; } return hi; }

void main() {
	int N, K;
	N.readM;
	K.readM;
	auto A = new int[N];
	foreach (i; 0 .. N) {
		A[i].readM;
	}
	auto O = new bool[N];
	foreach (i; 0 .. K) {
		O[N - 1 - i] = true;
	}
	int ans;
	do {
		long x;
		foreach (i; 0 .. N) {
			if (O[i]) {
				x += A[i];
			}
		}
		if (x % 998244353 <= x % 998) {
			++ans;
		}
	} while (O.nextPermutation);
	ans %= 998;
	writeln(ans);
}
0