結果
| 問題 |
No.640 76本のトロンボーン
|
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-03-23 19:48:10 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 582 ms / 2,000 ms |
| コード長 | 776 bytes |
| コンパイル時間 | 198 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 44,592 KB |
| 最終ジャッジ日時 | 2024-07-20 17:23:57 |
| 合計ジャッジ時間 | 12,076 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 15 |
ソースコード
#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N = int(readline())
S = np.frombuffer(read(), 'S1').reshape(N, -1)[:, :N].copy()
def solve_vertical(S):
H, W = S.shape
cond_1 = np.all(S[:-1] == b'.', axis=0)
cond_2 = np.all(S[1:] == b'.', axis=0)
return np.count_nonzero(cond_1 | cond_2)
def solve(S):
yield solve_vertical(S)
yield solve_vertical(S.T)
for _ in range(2):
S = S.T
for _ in range(4):
S = S[::-1].T
if np.all(S[0, 1:] == b'.'):
S[0, 1:] = b'#'
for x in solve(S):
yield x + 1
S[0, 1:] = b'.'
print(max(solve(S)))
maspy