結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 73 ms
71,312 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 73 ms
71,276 KB
testcase_06 WA -
testcase_07 AC 80 ms
75,484 KB
testcase_08 AC 80 ms
75,504 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 81 ms
75,372 KB
testcase_12 AC 80 ms
75,428 KB
testcase_13 WA -
testcase_14 AC 79 ms
75,464 KB
testcase_15 AC 74 ms
71,056 KB
testcase_16 AC 73 ms
71,464 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 row[0] == 0 or s == n-1 and row[-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