結果

問題 No.2711 Connecting Lights
ユーザー prd_xxxprd_xxx
提出日時 2024-03-31 14:29:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 382 ms / 5,000 ms
コード長 854 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 75,632 KB
最終ジャッジ日時 2024-03-31 14:29:15
合計ジャッジ時間 4,095 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,460 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 45 ms
61,964 KB
testcase_03 AC 37 ms
53,460 KB
testcase_04 AC 37 ms
53,460 KB
testcase_05 AC 56 ms
68,444 KB
testcase_06 AC 52 ms
64,444 KB
testcase_07 AC 53 ms
66,504 KB
testcase_08 AC 61 ms
68,592 KB
testcase_09 AC 235 ms
75,620 KB
testcase_10 AC 59 ms
70,624 KB
testcase_11 AC 86 ms
75,604 KB
testcase_12 AC 116 ms
75,632 KB
testcase_13 AC 72 ms
73,680 KB
testcase_14 AC 54 ms
66,508 KB
testcase_15 AC 101 ms
73,564 KB
testcase_16 AC 56 ms
68,444 KB
testcase_17 AC 57 ms
70,492 KB
testcase_18 AC 64 ms
70,640 KB
testcase_19 AC 60 ms
70,624 KB
testcase_20 AC 130 ms
75,632 KB
testcase_21 AC 56 ms
68,444 KB
testcase_22 AC 53 ms
66,504 KB
testcase_23 AC 54 ms
68,572 KB
testcase_24 AC 133 ms
75,620 KB
testcase_25 AC 194 ms
75,620 KB
testcase_26 AC 382 ms
75,620 KB
testcase_27 AC 161 ms
75,620 KB
testcase_28 AC 358 ms
75,620 KB
testcase_29 AC 65 ms
73,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,K = map(int,input().split())
MOD = 998244353

if M==1:
    exit(print(1<<N))

def popcnt(n):
    c = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555)
    c = (c & 0x3333333333333333) + ((c >> 2) & 0x3333333333333333)
    c = (c & 0x0f0f0f0f0f0f0f0f) + ((c >> 4) & 0x0f0f0f0f0f0f0f0f)
    c = (c & 0x00ff00ff00ff00ff) + ((c >> 8) & 0x00ff00ff00ff00ff)
    c = (c & 0x0000ffff0000ffff) + ((c >> 16) & 0x0000ffff0000ffff)
    c = (c & 0x00000000ffffffff) + ((c >> 32) & 0x00000000ffffffff)
    return c

dp = [0] * (1<<N)
for s in range(1<<N):
    if popcnt(s) < K: continue
    dp[s] = 1

for _ in range(M-1):
    ndp = [0] * (1<<N)
    for s in range(1<<N):
        if popcnt(s) < K: continue
        for t in range(1<<N):
            if popcnt(s&t) < K: continue
            ndp[t] = (ndp[t] + dp[s]) % MOD
    dp = ndp
print(sum(dp) % MOD)
0