結果

問題 No.2711 Connecting Lights
ユーザー k82bk82b
提出日時 2024-03-31 14:19:34
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 1,084 bytes
コンパイル時間 4,196 ms
コンパイル使用メモリ 193,768 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-31 14:19:40
合計ジャッジ時間 5,737 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 1 ms
6,676 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 50 ms
6,676 KB
testcase_10 AC 20 ms
6,676 KB
testcase_11 AC 37 ms
6,676 KB
testcase_12 AC 12 ms
6,676 KB
testcase_13 AC 12 ms
6,676 KB
testcase_14 AC 2 ms
6,676 KB
testcase_15 AC 11 ms
6,676 KB
testcase_16 AC 2 ms
6,676 KB
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 3 ms
6,676 KB
testcase_19 AC 28 ms
6,676 KB
testcase_20 AC 15 ms
6,676 KB
testcase_21 AC 2 ms
6,676 KB
testcase_22 AC 2 ms
6,676 KB
testcase_23 AC 1 ms
6,676 KB
testcase_24 AC 25 ms
6,676 KB
testcase_25 AC 38 ms
6,676 KB
testcase_26 AC 84 ms
6,676 KB
testcase_27 AC 50 ms
6,676 KB
testcase_28 AC 83 ms
6,676 KB
testcase_29 AC 41 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std, core.bitop;
bool chmin(T)(ref T SE, T MI) { if (SE > MI) { SE = MI; return true; } else { return false; } }
bool chmax(T)(ref T SE, T MI) { if (SE < MI) { SE = MI; return true; } else { return false; } }
int lowerBound(T)(T[] SE, T MI) { int lo = -1, hi = cast(int)(SE.length); while (hi - lo > 1) { int mid = lo + hi >> 1; (SE[mid] < MI ? lo : hi) = mid; } return hi; }
int upperBound(T)(T[] SE, T MI) { int lo = -1, hi = cast(int)(SE.length); while (hi - lo > 1) { int mid = lo + hi >> 1; (SE[mid] > MI ? hi : lo) = mid; } return hi; }
enum MO = 998244353;
void main() {
	int N, M, K;
	readf("%s %s %s\n", N, M, K);
	if (M == 1) {
		writeln(1 << N);
	}
	auto dp = new long[][](2, 1 << N);
	int cur;
	dp[cur][(1 << N) - 1] = 1;
	foreach (i; 0 .. M) {
		int nxt = !cur;
		foreach (j; 0 .. 1 << N) {
			dp[nxt][j] = 0;
		}
		foreach (j; 0 .. 1 << N) {
			foreach (k; 0 .. 1 << N) {
				if (popcnt(j & k) >= K) {
					(dp[nxt][k] += dp[cur][j]) %= MO;
				}
			}
		}
		cur = nxt;
	}
	long ans;
	foreach (i; 0 .. 1 << N) {
		ans += dp[cur][i];
	}
	ans %= MO;
	ans.writeln;
}
0