結果

問題 No.2692 How Many Times Reached?
ユーザー とりゐとりゐ
提出日時 2024-03-22 21:26:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 699 bytes
コンパイル時間 359 ms
コンパイル使用メモリ 82,360 KB
実行使用メモリ 64,512 KB
最終ジャッジ日時 2024-09-30 10:48:17
合計ジャッジ時間 3,344 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
S=[input() for i in range(N)]
ans=0
for x in range(N):
  A=0
  B=0
  C=0
  for y in range(N):
    if S[x][y]=='A':
      A+=1
    elif S[x][y]=='B':
      B+=1
    else:
      C+=1
  if (A,C)==(N-1,1):
    ans+=1
    
for y in range(N):
  A=0
  B=0
  C=0
  for x in range(N):
    if S[x][y]=='A':
      A+=1
    elif S[x][y]=='B':
      B+=1
    else:
      C+=1
  if (A,C)==(N-1,1):
    ans+=1

A=0
B=0
C=0
for x in range(N):
  if S[x][x]=='A':
    A+=1
  elif S[x][x]=='B':
    B+=1
  else:
    C+=1
if (A,C)==(N-1,1):
  ans+=1

A=0
B=0
C=0
for x in range(N):
  if S[x][N-1-x]=='A':
    A+=1
  elif S[x][N-1-x]=='B':
    B+=1
  else:
    C+=1
if (A,C)==(N-1,1):
  ans+=1

print(ans)
0