結果
問題 | No.2733 Just K-times TSP |
ユーザー | titia |
提出日時 | 2024-04-19 23:28:38 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 861 bytes |
コンパイル時間 | 286 ms |
コンパイル使用メモリ | 82,396 KB |
実行使用メモリ | 263,500 KB |
最終ジャッジ日時 | 2024-04-19 23:28:45 |
合計ジャッジ時間 | 6,518 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 42 ms
67,884 KB |
testcase_01 | AC | 46 ms
63,752 KB |
testcase_02 | AC | 37 ms
54,188 KB |
testcase_03 | AC | 36 ms
55,068 KB |
testcase_04 | AC | 38 ms
55,600 KB |
testcase_05 | AC | 37 ms
55,752 KB |
testcase_06 | AC | 39 ms
55,028 KB |
testcase_07 | AC | 39 ms
55,672 KB |
testcase_08 | AC | 37 ms
55,492 KB |
testcase_09 | AC | 102 ms
77,188 KB |
testcase_10 | AC | 37 ms
55,092 KB |
testcase_11 | AC | 37 ms
55,760 KB |
testcase_12 | AC | 54 ms
67,748 KB |
testcase_13 | AC | 49 ms
64,512 KB |
testcase_14 | AC | 152 ms
79,044 KB |
testcase_15 | AC | 410 ms
94,636 KB |
testcase_16 | AC | 93 ms
77,620 KB |
testcase_17 | AC | 1,303 ms
171,428 KB |
testcase_18 | TLE | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
ソースコード
import sys input = sys.stdin.readline from heapq import heappop,heappush from collections import Counter mod=998244353 N,M,K=map(int,input().split()) E=[[] for i in range(N)] for i in range(M): u,v=map(int,input().split()) u-=1 v-=1 E[u].append(v) E[v].append(u) Q=[] DP=Counter() for i in range(N): x=[i]+[0]*N x[i+1]+=1 DP[tuple(x)]=1 Q.append((1,tuple(x))) #print(DP) USE=set() while Q: #print(DP) SUM,L=heappop(Q) if L in USE: continue USE.add(L) #print(SUM,L) L2=list(L[1:]) for to in E[L[0]]: if L2[to]+1<=K: L2[to]+=1 DP[tuple([to]+L2)]+=DP[L] DP[tuple([to]+L2)]%=mod heappush(Q,(SUM+1,tuple([to]+L2))) L2[to]-=1 ANS=0 for i in range(N): x=[i]+[K]*N ANS+=DP[tuple(x)] print(ANS%mod)