結果
問題 | No.1937 Various Tournament |
ユーザー |
![]() |
提出日時 | 2024-04-08 18:57:13 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 820 ms / 2,000 ms |
コード長 | 1,357 bytes |
コンパイル時間 | 284 ms |
コンパイル使用メモリ | 82,272 KB |
実行使用メモリ | 90,752 KB |
最終ジャッジ日時 | 2024-10-01 10:29:00 |
合計ジャッジ時間 | 27,642 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 47 |
ソースコード
import sys# sys.setrecursionlimit(200005)# sys.set_int_max_str_digits(200005)int1 = lambda x: int(x)-1pDB = lambda *x: print(*x, end="\n", file=sys.stderr)p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)def II(): return int(sys.stdin.readline())def LI(): return list(map(int, sys.stdin.readline().split()))def LLI(rows_number): return [LI() for _ in range(rows_number)]def LI1(): return list(map(int1, sys.stdin.readline().split()))def LLI1(rows_number): return [LI1() for _ in range(rows_number)]def SI(): return sys.stdin.readline().rstrip()dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]# inf = -1-(-1 << 31)inf = -1-(-1 << 62)# md = 10**9+7md = 998244353# k桁までpc = [0]for _ in range(16): pc += [c+1 for c in pc]n = II()ss = LLI(n)dp = [[0]*n for _ in range(1 << n)]for i in range(n):dp[1<<i][i]=1for s in range(3, 1 << n):if pc[s]==1:continuefor i in range(n):if s >> i & 1 == 0: continuep = pc[s]if p != p & -p: continuem = s ^ 1 << it = mwhile t:if pc[t]*2 == p:for j in range(n):if t>>j&1 and ss[i][j]:dp[s][i]+=dp[s^t][i]*dp[t][j]*2t = (t-1) & mprint(*dp[-1],sep="\n")