結果
| 問題 | No.2692 How Many Times Reached? |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-22 22:16:56 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 27 ms / 2,000 ms |
| + 488µs | |
| コード長 | 693 bytes |
| 記録 | |
| コンパイル時間 | 544 ms |
| コンパイル使用メモリ | 14,720 KB |
| 実行使用メモリ | 11,392 KB |
| 最終ジャッジ日時 | 2026-10-20 20:49:30 |
| 合計ジャッジ時間 | 4,031 ms |
|
ジャッジサーバーID (参考情報) |
judge6_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 44 |
ソースコード
n=int(input())
s=[]
m=n
while m>0:
s.append(input())
m-=1
cntx=0
cnty=0
reaches=0
for i in range(n):
for j in range(n):
if s[i][j]=="A":
cntx+=1
elif s[i][j]=="B":
cntx=-1000
if s[j][i]=="A":
cnty+=1
elif s[j][i]=="B":
cnty=-1000
if cntx==n-1:
reaches+=1
if cnty==n-1:
reaches+=1
cntx=0
cnty=0
cntx=0
cnty=0
for i in range(n):
if s[i][i]=="A":
cntx+=1
elif s[i][i]=="B":
cntx=-1000
if s[i][n-1-i]=="A":
cnty+=1
elif s[i][n-1-i]=="B":
cnty=-1000
if cntx==n-1:
reaches+=1
if cnty==n-1:
reaches+=1
print(reaches)