Submission #6021737


Source Code Expand

Copy
import numpy as np
import sys
# 距離K以内にxが居ない
# xからの距離を測る

buf = sys.stdin.buffer
R,C,K = map(int,buf.readline().split())
black = np.ones((R+2,C+2),dtype=np.bool)
black[1:-1,1:] = (np.frombuffer(buf.read(R*(C+1)),dtype='S1') != b'o').reshape(R,C+1)

INF = 10 ** 9
dist = np.zeros((R+2,C+2),dtype=np.int32)
dist[~black] = INF

for n in range(1,R+1):
  np.minimum(dist[n-1]+1,dist[n],out=dist[n])
for n in range(R,0,-1):
  np.minimum(dist[n+1]+1,dist[n],out=dist[n])

for n in range(1,C+1):
  np.minimum(dist[:,n-1]+1,dist[:,n],out=dist[:,n])
for n in range(C,0,-1):
  np.minimum(dist[:,n+1]+1,dist[:,n],out=dist[:,n])

answer = (dist >= K).sum()
print(answer)

Submission Info

Submission Time
Task C - 菱型カウント
User maspy
Language Python (3.4.3)
Score 100
Code Size 715 Byte
Status AC
Exec Time 180 ms
Memory 14024 KB

Judge Result

Set Name Sample Subtask1 Subtask2
Score / Max Score 0 / 0 30 / 30 70 / 70
Status
AC × 3
AC × 23
AC × 43
Set Name Test Cases
Sample subtask0-sample01.txt, subtask0-sample02.txt, subtask0-sample03.txt
Subtask1 subtask0-sample01.txt, subtask0-sample02.txt, subtask0-sample03.txt, subtask1-01.txt, subtask1-02.txt, subtask1-03.txt, subtask1-04.txt, subtask1-05.txt, subtask1-06.txt, subtask1-07.txt, subtask1-08.txt, subtask1-09.txt, subtask1-10.txt, subtask1-11.txt, subtask1-12.txt, subtask1-13.txt, subtask1-14.txt, subtask1-15.txt, subtask1-16.txt, subtask1-17.txt, subtask1-18.txt, subtask1-19.txt, subtask1-20.txt
Subtask2 subtask0-sample01.txt, subtask0-sample02.txt, subtask0-sample03.txt, subtask1-01.txt, subtask1-02.txt, subtask1-03.txt, subtask1-04.txt, subtask1-05.txt, subtask1-06.txt, subtask1-07.txt, subtask1-08.txt, subtask1-09.txt, subtask1-10.txt, subtask1-11.txt, subtask1-12.txt, subtask1-13.txt, subtask1-14.txt, subtask1-15.txt, subtask1-16.txt, subtask1-17.txt, subtask1-18.txt, subtask1-19.txt, subtask1-20.txt, subtask2-01.txt, subtask2-02.txt, subtask2-03.txt, subtask2-04.txt, subtask2-05.txt, subtask2-06.txt, subtask2-07.txt, subtask2-08.txt, subtask2-09.txt, subtask2-10.txt, subtask2-11.txt, subtask2-12.txt, subtask2-13.txt, subtask2-14.txt, subtask2-15.txt, subtask2-16.txt, subtask2-17.txt, subtask2-18.txt, subtask2-19.txt, subtask2-20.txt
Case Name Status Exec Time Memory
subtask0-sample01.txt AC 148 ms 12488 KB
subtask0-sample02.txt AC 148 ms 12488 KB
subtask0-sample03.txt AC 148 ms 12488 KB
subtask1-01.txt AC 147 ms 12488 KB
subtask1-02.txt AC 148 ms 12488 KB
subtask1-03.txt AC 149 ms 12488 KB
subtask1-04.txt AC 149 ms 12488 KB
subtask1-05.txt AC 150 ms 12488 KB
subtask1-06.txt AC 149 ms 12488 KB
subtask1-07.txt AC 150 ms 12484 KB
subtask1-08.txt AC 151 ms 12488 KB
subtask1-09.txt AC 152 ms 12488 KB
subtask1-10.txt AC 151 ms 12488 KB
subtask1-11.txt AC 153 ms 12388 KB
subtask1-12.txt AC 151 ms 12488 KB
subtask1-13.txt AC 149 ms 12488 KB
subtask1-14.txt AC 150 ms 12484 KB
subtask1-15.txt AC 151 ms 12488 KB
subtask1-16.txt AC 150 ms 12488 KB
subtask1-17.txt AC 151 ms 12484 KB
subtask1-18.txt AC 151 ms 12488 KB
subtask1-19.txt AC 150 ms 12488 KB
subtask1-20.txt AC 150 ms 12488 KB
subtask2-01.txt AC 161 ms 12984 KB
subtask2-02.txt AC 161 ms 12984 KB
subtask2-03.txt AC 152 ms 12488 KB
subtask2-04.txt AC 163 ms 12980 KB
subtask2-05.txt AC 178 ms 13896 KB
subtask2-06.txt AC 179 ms 13896 KB
subtask2-07.txt AC 178 ms 14024 KB
subtask2-08.txt AC 177 ms 14024 KB
subtask2-09.txt AC 178 ms 13896 KB
subtask2-10.txt AC 177 ms 13896 KB
subtask2-11.txt AC 177 ms 13896 KB
subtask2-12.txt AC 177 ms 13896 KB
subtask2-13.txt AC 180 ms 13896 KB
subtask2-14.txt AC 177 ms 13924 KB
subtask2-15.txt AC 178 ms 13896 KB
subtask2-16.txt AC 178 ms 14024 KB
subtask2-17.txt AC 177 ms 13896 KB
subtask2-18.txt AC 177 ms 13896 KB
subtask2-19.txt AC 178 ms 13896 KB
subtask2-20.txt AC 178 ms 13896 KB