Submission #15008075


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):
    rows = [i for i in range(H) if x & (1<<i)]
    cols = [i for i in range(W) if y & (1<<i)]
    D = C[rows][:,cols]
    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 531 Byte
Status
Exec Time 168 ms
Memory 27300 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 118 ms 26920 KB
a02.txt 113 ms 26940 KB
a03.txt 120 ms 27276 KB
a04.txt 164 ms 27268 KB
b05.txt 118 ms 26748 KB
b06.txt 162 ms 27300 KB
b07.txt 157 ms 26980 KB
b08.txt 162 ms 26976 KB
b09.txt 122 ms 27032 KB
b10.txt 168 ms 27088 KB
b11.txt 159 ms 27292 KB
b12.txt 157 ms 27008 KB
b13.txt 120 ms 26748 KB
b14.txt 111 ms 27040 KB
b15.txt 168 ms 26964 KB
b16.txt 115 ms 26752 KB