結果

問題 No.1937 Various Tournament
ユーザー googol_S0googol_S0
提出日時 2022-05-13 21:34:46
言語 PyPy3
(7.9.16)
結果
AC  
実行時間 536 ms / 2,000 ms
コード長 654 bytes
コンパイル時間 265 ms
実行使用メモリ 97,056 KB
最終ジャッジ日時 2023-02-21 13:26:24
合計ジャッジ時間 19,856 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
75,440 KB
testcase_01 AC 430 ms
96,540 KB
testcase_02 AC 500 ms
96,492 KB
testcase_03 AC 508 ms
96,692 KB
testcase_04 AC 501 ms
96,756 KB
testcase_05 AC 97 ms
80,936 KB
testcase_06 AC 517 ms
96,552 KB
testcase_07 AC 522 ms
96,756 KB
testcase_08 AC 95 ms
80,616 KB
testcase_09 AC 529 ms
96,440 KB
testcase_10 AC 95 ms
80,820 KB
testcase_11 AC 484 ms
96,568 KB
testcase_12 AC 526 ms
96,764 KB
testcase_13 AC 501 ms
96,688 KB
testcase_14 AC 514 ms
97,056 KB
testcase_15 AC 515 ms
96,736 KB
testcase_16 AC 523 ms
96,436 KB
testcase_17 AC 509 ms
96,672 KB
testcase_18 AC 536 ms
96,524 KB
testcase_19 AC 509 ms
96,544 KB
testcase_20 AC 96 ms
80,600 KB
testcase_21 AC 83 ms
75,708 KB
testcase_22 AC 494 ms
96,732 KB
testcase_23 AC 509 ms
96,512 KB
testcase_24 AC 496 ms
96,740 KB
testcase_25 AC 97 ms
80,632 KB
testcase_26 AC 511 ms
96,664 KB
testcase_27 AC 84 ms
75,660 KB
testcase_28 AC 489 ms
96,576 KB
testcase_29 AC 95 ms
80,636 KB
testcase_30 AC 514 ms
96,552 KB
testcase_31 AC 503 ms
96,524 KB
testcase_32 AC 525 ms
96,820 KB
testcase_33 AC 529 ms
96,752 KB
testcase_34 AC 514 ms
96,460 KB
testcase_35 AC 513 ms
96,528 KB
testcase_36 AC 514 ms
96,664 KB
testcase_37 AC 97 ms
80,584 KB
testcase_38 AC 96 ms
80,572 KB
testcase_39 AC 509 ms
96,640 KB
testcase_40 AC 103 ms
80,952 KB
testcase_41 AC 97 ms
80,680 KB
testcase_42 AC 518 ms
96,564 KB
testcase_43 AC 97 ms
80,752 KB
testcase_44 AC 83 ms
75,692 KB
testcase_45 AC 525 ms
96,832 KB
testcase_46 AC 96 ms
80,904 KB
testcase_47 AC 84 ms
75,452 KB
testcase_48 AC 83 ms
75,748 KB
testcase_49 AC 96 ms
80,576 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