結果

問題 No.640 76本のトロンボーン
ユーザー mkawa2mkawa2
提出日時 2021-12-05 23:55:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,404 bytes
コンパイル時間 344 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 75,584 KB
最終ジャッジ日時 2023-09-21 15:03:08
合計ジャッジ時間 3,162 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 70 ms
71,388 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 68 ms
71,036 KB
testcase_06 WA -
testcase_07 AC 77 ms
75,436 KB
testcase_08 AC 75 ms
75,456 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 76 ms
75,388 KB
testcase_12 AC 75 ms
75,368 KB
testcase_13 WA -
testcase_14 AC 76 ms
75,312 KB
testcase_15 AC 70 ms
71,300 KB
testcase_16 AC 71 ms
71,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
# inf = 18446744073709551615
inf = 4294967295
md = 10**9+7
# md = 998244353

def rot90(aa):
    return [col[::-1] for col in zip(*aa)]

def cnt1(aa):
    res = 0
    for row in aa:
        s = sum(row)
        if s == n or s == n-1 and aa[-1][0] == 0 or s == n-1 and aa[-1][-1] == 0: res += 1
        return res

def cnt2(aa):
    for i in range(n-1):
        if aa[i][0] == 0: return 0
    res = 1
    for i in range(n-1):
        s = sum(aa[i][1:])
        if s == n-1: res += 1
    s = sum(aa[-1])
    if s == n or s == n-1 and aa[-1][0] == 0: res += 1
    return res

n = II()
aa = [[c == "." for c in SI()] for _ in range(n)]

ans = 0
ans = max(ans, cnt1(aa))
aa = rot90(aa)
ans = max(ans, cnt1(aa))

for _ in range(2):
    for _ in range(4):
        ans = max(ans, cnt2(aa))
        aa = rot90(aa)
    aa = aa[::-1]

print(ans)
0