結果
| 問題 |
No.2692 How Many Times Reached?
|
| コンテスト | |
| ユーザー |
mymelochan
|
| 提出日時 | 2024-03-22 21:27:39 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 60 ms / 2,000 ms |
| コード長 | 1,239 bytes |
| コンパイル時間 | 394 ms |
| コンパイル使用メモリ | 82,104 KB |
| 実行使用メモリ | 65,536 KB |
| 最終ジャッジ日時 | 2024-09-30 10:49:45 |
| 合計ジャッジ時間 | 3,711 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 43 |
ソースコード
#############################################################
import sys
sys.setrecursionlimit(10**7)
from heapq import heappop,heappush
from collections import deque,defaultdict,Counter
from bisect import bisect_left, bisect_right
from itertools import product,combinations,permutations
ipt = sys.stdin.readline
def iin():
return int(ipt())
def lmin():
return list(map(int,ipt().split()))
MOD = 998244353
#############################################################
N = iin()
S = [input() for _ in range(N)]
ans = 0
for i in range(N):
cnt = 0
b = 0
for j in range(N):
if S[i][j] == "A":
cnt += 1
if S[i][j] == "B":
b = 1
if cnt == N-1 and not b:
ans += 1
cnt = 0
b = 0
for j in range(N):
if S[j][i] == "A":
cnt += 1
if S[j][i] == "B":
b = 1
if cnt == N-1 and not b:
ans += 1
cnt = 0
for i in range(N):
if S[i][i] == "A":
cnt += 1
if S[i][i] == "B":
break
else:
if cnt == N-1:
ans += 1
cnt = 0
for i in range(N):
if S[i][N-i-1] == "A":
cnt += 1
if S[i][N-i-1] == "B":
break
else:
if cnt == N-1:
ans += 1
print(ans)
mymelochan