結果
問題 | No.2692 How Many Times Reached? |
ユーザー |
|
提出日時 | 2024-03-22 21:43:34 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 58 ms / 2,000 ms |
コード長 | 785 bytes |
コンパイル時間 | 445 ms |
コンパイル使用メモリ | 82,128 KB |
実行使用メモリ | 67,840 KB |
最終ジャッジ日時 | 2024-09-30 11:12:20 |
合計ジャッジ時間 | 3,356 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 43 |
ソースコード
from collections import defaultdictN = int(input())S = [list(input()) for _ in range(N)]R = [defaultdict(int) for _ in range(N)]C = [defaultdict(int) for _ in range(N)]for i in range(N):for j in range(N):R[i][S[i][j]] += 1for j in range(N):for i in range(N):C[j][S[i][j]] += 1Right = defaultdict(int)Left = defaultdict(int)for i in range(N):Right[S[i][i]] += 1Left[S[N - 1 - i][i]] += 1ans = 0for i in range(N):for j in range(N):if S[i][j] != ".":continueif R[i]["A"] == N - 1:ans += 1if C[j]["A"] == N - 1:ans += 1if i == j and Right["A"] == N - 1:ans += 1if i + j == N - 1 and Left["A"] == N - 1:ans += 1print(ans)