結果

問題 No.640 76本のトロンボーン
ユーザー wajima_wataruwajima_wataru
提出日時 2018-03-03 17:14:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,220 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 10,952 KB
実行使用メモリ 8,388 KB
最終ジャッジ日時 2023-09-12 16:49:28
合計ジャッジ時間 1,357 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,168 KB
testcase_01 AC 16 ms
8,328 KB
testcase_02 AC 16 ms
8,212 KB
testcase_03 WA -
testcase_04 AC 16 ms
8,312 KB
testcase_05 AC 16 ms
8,328 KB
testcase_06 WA -
testcase_07 AC 18 ms
8,268 KB
testcase_08 AC 18 ms
8,140 KB
testcase_09 AC 18 ms
8,268 KB
testcase_10 AC 18 ms
8,128 KB
testcase_11 AC 18 ms
8,216 KB
testcase_12 AC 17 ms
8,204 KB
testcase_13 WA -
testcase_14 AC 17 ms
8,268 KB
testcase_15 AC 16 ms
8,208 KB
testcase_16 AC 16 ms
8,204 KB
権限があれば一括ダウンロードができます

ソースコード

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