結果

問題 No.640 76本のトロンボーン
ユーザー wajima_wataru
提出日時 2018-03-03 17:14:45
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 1,220 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-06-30 04:43:45
合計ジャッジ時間 1,284 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 12 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = []
S_ = [[] for _ in range(N)]
for _ in range(N):
    tmp = []
    for i, c in enumerate(input()):
        tmp.append(c)
        S_[i].append(c)
    S.append(tmp)

num1 = 0
edge = S_[N - 1]
for i, row in enumerate(S):
    if '#' not in row[:N - 1]:
        num1 += 1
    elif '#' not in row[1:]:
        num1 += 1
        edge[i] = '#'
if '#' not in edge[:N - 1] or '#' not in edge[1:]:
    num1 += 1
# print(num1)

num2 = 0
edge = S_[0]
for i, row in enumerate(S):
    if '#' not in row[1:]:
        num2 += 1
    elif '#' not in row[:N - 1]:
        num2 += 1
        edge[i] = '#'
if '#' not in edge[:N - 1] or '#' not in edge[1:]:
    num2 += 1
# print(num2)

num3 = 0
edge = S[N - 1]
for i, row in enumerate(S_):
    if '#' not in row[:N - 1]:
        num3 += 1
    elif '#' not in row[1:]:
        num3 += 1
        edge[i] = '#'
if '#' not in edge[:N - 1] or '#' not in edge[1:]:
    num3 += 1
# print(num3)

num4 = 0
edge = S[0]
for i, row in enumerate(S_):
    if '#' not in row[1:]:
        num4 += 1
    elif '#' not in row[:N - 1]:
        num4 += 1
        edge[i] = '#'
if '#' not in edge[:N - 1] or '#' not in edge[1:]:
    num4 += 1
# print(num4)

print(max(num1, num2, num3, num4))
0