結果

問題 No.1937 Various Tournament
ユーザー googol_S0googol_S0
提出日時 2022-05-13 21:34:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 546 ms / 2,000 ms
コード長 654 bytes
コンパイル時間 326 ms
コンパイル使用メモリ 86,580 KB
実行使用メモリ 92,608 KB
最終ジャッジ日時 2023-09-29 06:36:10
合計ジャッジ時間 20,552 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
70,988 KB
testcase_01 AC 463 ms
92,212 KB
testcase_02 AC 515 ms
92,032 KB
testcase_03 AC 516 ms
91,968 KB
testcase_04 AC 506 ms
91,808 KB
testcase_05 AC 85 ms
75,892 KB
testcase_06 AC 531 ms
91,732 KB
testcase_07 AC 519 ms
92,148 KB
testcase_08 AC 84 ms
75,948 KB
testcase_09 AC 546 ms
92,140 KB
testcase_10 AC 84 ms
75,908 KB
testcase_11 AC 493 ms
92,024 KB
testcase_12 AC 539 ms
92,088 KB
testcase_13 AC 509 ms
92,448 KB
testcase_14 AC 521 ms
91,816 KB
testcase_15 AC 521 ms
92,072 KB
testcase_16 AC 531 ms
92,172 KB
testcase_17 AC 519 ms
91,940 KB
testcase_18 AC 539 ms
92,076 KB
testcase_19 AC 516 ms
91,764 KB
testcase_20 AC 84 ms
76,048 KB
testcase_21 AC 73 ms
70,860 KB
testcase_22 AC 502 ms
92,388 KB
testcase_23 AC 513 ms
91,820 KB
testcase_24 AC 501 ms
92,104 KB
testcase_25 AC 83 ms
75,860 KB
testcase_26 AC 517 ms
92,124 KB
testcase_27 AC 73 ms
70,964 KB
testcase_28 AC 491 ms
91,812 KB
testcase_29 AC 84 ms
75,808 KB
testcase_30 AC 528 ms
91,972 KB
testcase_31 AC 518 ms
91,996 KB
testcase_32 AC 542 ms
92,256 KB
testcase_33 AC 545 ms
91,784 KB
testcase_34 AC 530 ms
91,896 KB
testcase_35 AC 515 ms
92,028 KB
testcase_36 AC 519 ms
92,044 KB
testcase_37 AC 83 ms
76,000 KB
testcase_38 AC 83 ms
75,816 KB
testcase_39 AC 524 ms
92,340 KB
testcase_40 AC 84 ms
75,972 KB
testcase_41 AC 84 ms
75,808 KB
testcase_42 AC 524 ms
92,176 KB
testcase_43 AC 86 ms
75,928 KB
testcase_44 AC 74 ms
70,736 KB
testcase_45 AC 519 ms
92,608 KB
testcase_46 AC 83 ms
75,832 KB
testcase_47 AC 71 ms
71,068 KB
testcase_48 AC 72 ms
71,084 KB
testcase_49 AC 83 ms
75,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
S=[list(map(int,input().split())) for i in range(N)]
M=1<<N
DP=[[0]*N for i in range(M)]
F=[0]*M
B=[bin(i).count('1') for i in range(M)]
def f(X):
  if F[X]:
    return DP[X][:]
  if (X&(-X))==X:
    DP[X][X.bit_length()-1]=1
    F[X]=1
    return DP[X][:]
  v=0
  while 1:
    v=(v-1)&X
    if B[v]==B[v^X]:
      a,b=f(v),f(v^X)
      for i in range(N):
        if a[i]:
          for j in range(N):
            if b[j]:
              if S[i][j]:
                DP[X][i]+=a[i]*b[j]
              else:
                DP[X][j]+=a[i]*b[j]
    if v==0:
      break
  F[X]=1
  return DP[X][:]

f(M-1)
for i in range(N):
  print(DP[M-1][i])
0