結果
| 問題 | No.3428 Palindromic Path (Easy) |
| コンテスト | |
| ユーザー |
Tuchmos
|
| 提出日時 | 2026-01-11 15:30:22 |
| 言語 | Python3 (3.14.2 + numpy 2.4.0 + scipy 1.16.3) |
| 結果 |
AC
|
| 実行時間 | 211 ms / 2,000 ms |
| コード長 | 352 bytes |
| 記録 | |
| コンパイル時間 | 752 ms |
| コンパイル使用メモリ | 20,804 KB |
| 実行使用メモリ | 15,484 KB |
| 最終ジャッジ日時 | 2026-01-11 15:30:25 |
| 合計ジャッジ時間 | 3,250 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 |
ソースコード
N=int(input())
S=[list(input()) for i in range(N)]
ans=0
def dfs(i,j,cur):
global ans
if i==j==N-1:
ans+=cur[::-1]==cur
return
if i<N-1:
cur.append(S[i+1][j])
dfs(i+1,j,cur)
cur.pop()
if j<N-1:
cur.append(S[i][j+1])
dfs(i,j+1,cur)
cur.pop()
dfs(0,0,[S[0][0]])
print(ans)
Tuchmos