結果

問題 No.640 76本のトロンボーン
ユーザー wajima_wataruwajima_wataru
提出日時 2018-03-03 17:17:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,310 bytes
コンパイル時間 260 ms
コンパイル使用メモリ 10,912 KB
実行使用メモリ 8,188 KB
最終ジャッジ日時 2023-09-04 04:52:45
合計ジャッジ時間 1,432 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,076 KB
testcase_01 AC 16 ms
8,104 KB
testcase_02 AC 15 ms
8,064 KB
testcase_03 WA -
testcase_04 AC 16 ms
8,052 KB
testcase_05 AC 16 ms
8,052 KB
testcase_06 AC 18 ms
8,188 KB
testcase_07 AC 18 ms
8,104 KB
testcase_08 AC 18 ms
8,112 KB
testcase_09 AC 18 ms
8,188 KB
testcase_10 AC 18 ms
8,104 KB
testcase_11 AC 18 ms
8,152 KB
testcase_12 AC 18 ms
8,092 KB
testcase_13 AC 16 ms
8,028 KB
testcase_14 AC 18 ms
8,096 KB
testcase_15 AC 16 ms
8,056 KB
testcase_16 AC 15 ms
8,112 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)

num5 = 0
if '#' not in S[0] + S[N-1] + S_[0] + S_[N-1]:
    num5 = 4
# print(num5)

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