Submission #10405467


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):
    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])
# print(*dp,sep="\n")

Submission Info

Submission Time
Task O - Matching
User hitokage8000
Language PyPy3 (2.4.0)
Score 0
Code Size 581 Byte
Status TLE
Exec Time 2110 ms
Memory 395032 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 5
TLE × 12
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 160 ms 38256 KB
0_01 AC 162 ms 38256 KB
0_02 AC 161 ms 38256 KB
0_03 TLE 2110 ms 395032 KB
1_00 AC 160 ms 38256 KB
1_01 AC 160 ms 38256 KB
1_02 TLE 2110 ms 394904 KB
1_03 TLE 2110 ms 394904 KB
1_04 TLE 2110 ms 394904 KB
1_05 TLE 2110 ms 394904 KB
1_06 TLE 2110 ms 395032 KB
1_07 TLE 2110 ms 394904 KB
1_08 TLE 2110 ms 394904 KB
1_09 TLE 2110 ms 394904 KB
1_10 TLE 2110 ms 395032 KB
1_11 TLE 2110 ms 395032 KB
1_12 TLE 2110 ms 395032 KB