Submission #10405765


Source Code Expand

#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n = int(input())
A = [list(map(int,input().split())) for i in range(n)]
dp = [[0]*(1<<n) for i in range(n+1)]
dp[0][0] = 1
for i in range(n):
  for bit in range(1<<n):
    if not dp[i][bit]: continue
    for k in range(n):
      if not (bit & 1<<k)  and A[i][k]:
        dp[i+1][bit|1<<k] += dp[i][bit]
        dp[i+1][bit|1<<k] %= mod
print(dp[n][(1<<n)-1])

Submission Info

Submission Time
Task O - Matching
User hitokage8000
Language PyPy3 (2.4.0)
Score 100
Code Size 591 Byte
Status AC
Exec Time 1815 ms
Memory 394904 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 17
Set Name Test Cases
All 0_00, 0_01, 0_02, 0_03, 1_00, 1_01, 1_02, 1_03, 1_04, 1_05, 1_06, 1_07, 1_08, 1_09, 1_10, 1_11, 1_12
Case Name Status Exec Time Memory
0_00 AC 180 ms 38256 KB
0_01 AC 173 ms 38256 KB
0_02 AC 172 ms 38256 KB
0_03 AC 1539 ms 394904 KB
1_00 AC 172 ms 38256 KB
1_01 AC 171 ms 38256 KB
1_02 AC 693 ms 394904 KB
1_03 AC 670 ms 394904 KB
1_04 AC 773 ms 394904 KB
1_05 AC 885 ms 394904 KB
1_06 AC 1438 ms 394904 KB
1_07 AC 1542 ms 394904 KB
1_08 AC 1634 ms 394904 KB
1_09 AC 1653 ms 394904 KB
1_10 AC 1674 ms 394904 KB
1_11 AC 1815 ms 394904 KB
1_12 AC 1739 ms 394904 KB