結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,128 KB
testcase_01 AC 73 ms
71,128 KB
testcase_02 AC 73 ms
71,464 KB
testcase_03 AC 73 ms
71,576 KB
testcase_04 AC 73 ms
71,156 KB
testcase_05 AC 72 ms
71,440 KB
testcase_06 WA -
testcase_07 AC 82 ms
75,820 KB
testcase_08 AC 81 ms
75,676 KB
testcase_09 AC 80 ms
75,632 KB
testcase_10 AC 80 ms
75,548 KB
testcase_11 AC 83 ms
75,596 KB
testcase_12 AC 81 ms
75,760 KB
testcase_13 WA -
testcase_14 AC 80 ms
75,528 KB
testcase_15 AC 74 ms
71,564 KB
testcase_16 AC 74 ms
71,260 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:
        if sum(row[:-1]) == n-1 or sum(row[1:]) == n-1: res += 1
    return res

def cnt2(aa):
    for i in range(n-1):
        if aa[i][0] == 0: return 0
    res = 1
    for row in aa[:-1]:
        if sum(row[1:]) == n-1: res += 1
    if sum(aa[-1][:-1]) == n-1 or sum(aa[-1][1:]) == n-1: 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