結果

問題 No.2692 How Many Times Reached?
コンテスト
ユーザー hiro1729
提出日時 2024-03-22 21:23:37
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 66 ms / 2,000 ms
+ 618µs
コード長 582 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 236 ms
コンパイル使用メモリ 96,204 KB
実行使用メモリ 82,944 KB
最終ジャッジ日時 2026-09-06 16:35:38
合計ジャッジ時間 5,549 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = int(input())
S = [input() for _ in range(N)]
ans = 0
for i in range(N):
	if S[i].count('A') == N - 1 and S[i].count('.') == 1:
		ans += 1
for i in range(N):
	ca = 0
	cd = 0
	for j in range(N):
		if S[j][i] == 'A':
			ca += 1
		if S[j][i] == '.':
			cd += 1
	if ca == N - 1 and cd == 1:
		ans += 1
ca1 = 0
cd1 = 0
ca2 = 0
cd2 = 0
for i in range(N):
	if S[i][i] == 'A':
		ca1 += 1
	if S[i][i] == '.':
		cd1 += 1
	if S[i][N - 1 - i] == 'A':
		ca2 += 1
	if S[i][N - 1 - i] == '.':
		cd2 += 1
if ca1 == N - 1 and cd1 == 1:
	ans += 1
if ca2 == N - 1 and cd2 == 1:
	ans += 1
print(ans)
0