結果

問題 No.2733 Just K-times TSP
ユーザー detteiuudetteiuu
提出日時 2024-04-24 21:19:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 528 bytes
コンパイル時間 333 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 141,056 KB
最終ジャッジ日時 2024-04-24 21:19:41
合計ジャッジ時間 6,273 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
52,224 KB
testcase_01 AC 44 ms
52,224 KB
testcase_02 AC 43 ms
52,096 KB
testcase_03 AC 42 ms
52,480 KB
testcase_04 AC 42 ms
51,968 KB
testcase_05 AC 42 ms
52,480 KB
testcase_06 AC 47 ms
52,224 KB
testcase_07 AC 42 ms
51,968 KB
testcase_08 AC 42 ms
52,096 KB
testcase_09 AC 55 ms
61,824 KB
testcase_10 AC 41 ms
52,096 KB
testcase_11 AC 42 ms
52,224 KB
testcase_12 AC 57 ms
62,592 KB
testcase_13 AC 44 ms
52,352 KB
testcase_14 AC 63 ms
65,280 KB
testcase_15 WA -
testcase_16 AC 62 ms
63,744 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 53 ms
62,336 KB
testcase_21 AC 77 ms
72,576 KB
testcase_22 WA -
testcase_23 AC 101 ms
82,048 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 45 ms
52,608 KB
testcase_27 AC 61 ms
64,000 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 156 ms
82,304 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M, K = map(int, input().split())
G = [[] for _ in range(N)]
for _ in range(M):
    u, v = map(int, input().split())
    G[u-1].append(v-1)
    G[v-1].append(u-1)

MOD = 998244353
dp = [[0]*N for _ in range((K+1)**N)]
for i in range(N):
    dp[(K+1)**i][i] = 1

for i in range((K+1)**N):
    for j in range(N):
        if dp[i][j] >= 1:
            for v in G[j]:
                if i//((K+1)**v)%(K+1) < K:
                    dp[i+((K+1)**v)][v] += dp[i][j]
                    dp[i+((K+1)**v)][v] %= MOD

print(sum(dp[-1]))
0