Submission #14979765


Source Code Expand

Copy
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

H, W, K = map(int, readline().split())
C = np.frombuffer(read(), 'S1').reshape(H, -1)[:, :W]

C = 1 * (C == b'#')

def f(C, x, y):
    D = C.copy()
    for i in range(H):
        if x & (1 << i):
            D[i] = 0
    for i in range(W):
        if y & (1 << i):
            D[:, i] = 0
    return D.sum() == K

ans = 0
for x in range(1 << H):
    for y in range(1 << W):
        ans += f(C, x, y)
print(ans)

Submission Info

Submission Time
Task C - H and V
User maspy
Language Python (3.8.2)
Score 300
Code Size 573 Byte
Status
Exec Time 166 ms
Memory 27248 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 a01.txt, a02.txt, a03.txt, a04.txt
All 300 / 300 a01.txt, a02.txt, a03.txt, a04.txt, b05.txt, b06.txt, b07.txt, b08.txt, b09.txt, b10.txt, b11.txt, b12.txt, b13.txt, b14.txt, b15.txt, b16.txt
Case Name Status Exec Time Memory
a01.txt 125 ms 27100 KB
a02.txt 126 ms 27240 KB
a03.txt 127 ms 26760 KB
a04.txt 166 ms 26896 KB
b05.txt 128 ms 27064 KB
b06.txt 165 ms 27244 KB
b07.txt 158 ms 26996 KB
b08.txt 162 ms 26760 KB
b09.txt 130 ms 27248 KB
b10.txt 155 ms 26940 KB
b11.txt 159 ms 26724 KB
b12.txt 155 ms 26996 KB
b13.txt 122 ms 27244 KB
b14.txt 119 ms 26980 KB
b15.txt 162 ms 27056 KB
b16.txt 122 ms 26764 KB