結果
問題 | No.640 76本のトロンボーン |
ユーザー | mkawa2 |
提出日時 | 2021-12-06 00:13:37 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 78 ms / 2,000 ms |
コード長 | 1,554 bytes |
コンパイル時間 | 252 ms |
コンパイル使用メモリ | 86,720 KB |
実行使用メモリ | 75,836 KB |
最終ジャッジ日時 | 2023-09-21 15:03:24 |
合計ジャッジ時間 | 2,366 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 69 ms
71,224 KB |
testcase_01 | AC | 68 ms
71,128 KB |
testcase_02 | AC | 68 ms
71,240 KB |
testcase_03 | AC | 70 ms
71,248 KB |
testcase_04 | AC | 70 ms
71,028 KB |
testcase_05 | AC | 68 ms
71,344 KB |
testcase_06 | AC | 78 ms
75,704 KB |
testcase_07 | AC | 78 ms
75,532 KB |
testcase_08 | AC | 78 ms
75,628 KB |
testcase_09 | AC | 76 ms
75,572 KB |
testcase_10 | AC | 78 ms
75,836 KB |
testcase_11 | AC | 78 ms
75,836 KB |
testcase_12 | AC | 77 ms
75,824 KB |
testcase_13 | AC | 70 ms
71,164 KB |
testcase_14 | AC | 77 ms
75,536 KB |
testcase_15 | AC | 70 ms
71,384 KB |
testcase_16 | AC | 69 ms
71,212 KB |
ソースコード
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 def cnt3(aa): if sum(aa[0]) < n: return 0 if sum(aa[-1]) < n: return 0 if sum(aa[i][0] for i in range(n)) < n: return 0 if sum(aa[i][-1] for i in range(n)) < n: return 0 return 4 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] ans = max(ans, cnt3(aa)) print(ans)