結果
問題 | No.1937 Various Tournament |
ユーザー | chineristAC |
提出日時 | 2021-12-28 02:30:28 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 749 ms / 2,000 ms |
コード長 | 1,234 bytes |
コンパイル時間 | 432 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 91,884 KB |
最終ジャッジ日時 | 2024-07-06 02:44:39 |
合計ジャッジ時間 | 26,280 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 80 ms
77,240 KB |
testcase_01 | AC | 708 ms
91,520 KB |
testcase_02 | AC | 703 ms
91,680 KB |
testcase_03 | AC | 699 ms
91,624 KB |
testcase_04 | AC | 686 ms
91,684 KB |
testcase_05 | AC | 94 ms
78,080 KB |
testcase_06 | AC | 708 ms
91,496 KB |
testcase_07 | AC | 696 ms
91,520 KB |
testcase_08 | AC | 94 ms
77,952 KB |
testcase_09 | AC | 708 ms
91,440 KB |
testcase_10 | AC | 94 ms
77,824 KB |
testcase_11 | AC | 685 ms
91,656 KB |
testcase_12 | AC | 712 ms
91,464 KB |
testcase_13 | AC | 702 ms
91,520 KB |
testcase_14 | AC | 692 ms
91,508 KB |
testcase_15 | AC | 696 ms
91,648 KB |
testcase_16 | AC | 735 ms
91,652 KB |
testcase_17 | AC | 740 ms
91,428 KB |
testcase_18 | AC | 708 ms
91,500 KB |
testcase_19 | AC | 718 ms
91,748 KB |
testcase_20 | AC | 99 ms
77,924 KB |
testcase_21 | AC | 83 ms
77,036 KB |
testcase_22 | AC | 716 ms
91,576 KB |
testcase_23 | AC | 748 ms
91,636 KB |
testcase_24 | AC | 736 ms
91,540 KB |
testcase_25 | AC | 98 ms
77,748 KB |
testcase_26 | AC | 725 ms
91,648 KB |
testcase_27 | AC | 85 ms
77,184 KB |
testcase_28 | AC | 736 ms
91,884 KB |
testcase_29 | AC | 99 ms
77,824 KB |
testcase_30 | AC | 725 ms
91,680 KB |
testcase_31 | AC | 727 ms
91,592 KB |
testcase_32 | AC | 714 ms
91,520 KB |
testcase_33 | AC | 726 ms
91,644 KB |
testcase_34 | AC | 710 ms
91,724 KB |
testcase_35 | AC | 731 ms
91,520 KB |
testcase_36 | AC | 717 ms
91,564 KB |
testcase_37 | AC | 95 ms
78,072 KB |
testcase_38 | AC | 101 ms
77,696 KB |
testcase_39 | AC | 715 ms
91,436 KB |
testcase_40 | AC | 96 ms
77,824 KB |
testcase_41 | AC | 100 ms
77,952 KB |
testcase_42 | AC | 712 ms
91,520 KB |
testcase_43 | AC | 98 ms
77,696 KB |
testcase_44 | AC | 81 ms
77,056 KB |
testcase_45 | AC | 749 ms
91,520 KB |
testcase_46 | AC | 95 ms
78,080 KB |
testcase_47 | AC | 80 ms
77,312 KB |
testcase_48 | AC | 82 ms
77,056 KB |
testcase_49 | AC | 96 ms
78,080 KB |
ソースコード
from os import cpu_count import sys,random,bisect from collections import deque,defaultdict from heapq import heapify,heappop,heappush from itertools import permutations from math import log,gcd input = lambda :sys.stdin.readline() mi = lambda :map(int,input().split()) li = lambda :list(mi()) popcount = [bin(i).count("1") for i in range(2**16)] N = int(input()) A = [li() for i in range(N)] #A = [[random.randint(0,99)&1 for j in range(N)] for i in range(N)] #for i in range(N): #for j in range(i+1,N): #A[i][j] = 1 - A[j][i] dp = [[0 for i in range(N)] for S in range(1<<N)] for i in range(N): dp[2**i][i] = 1 for S in range(1<<N): n = bin(S).count("1") if n not in (2,4,8,16): continue tmp = S while tmp: t = S - tmp if popcount[tmp]!=popcount[S-tmp]: tmp = (tmp-1) & S continue for j in range(N): if tmp>>j & 1==0: continue for k in range(j+1,N): if A[j][k]: dp[S][j] += dp[tmp][j] * dp[S-tmp][k] * 2 else: dp[S][k] += dp[tmp][j] * dp[S-tmp][k] * 2 tmp = (tmp-1) & S for k in range(N): print(dp[2**N-1][k])