結果
| 問題 |
No.2928 Gridpath
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-02-07 16:44:00 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 189 ms / 2,000 ms |
| コード長 | 452 bytes |
| コンパイル時間 | 228 ms |
| コンパイル使用メモリ | 83,016 KB |
| 実行使用メモリ | 79,492 KB |
| 最終ジャッジ日時 | 2025-02-07 16:44:03 |
| 合計ジャッジ時間 | 3,056 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
h,w=map(int,input().split());s,t=[int(x)-1 for x in input().split()];g,k=[int(x)-1 for x in input().split()]
F=[[0]*w for _ in[0]*h];ans=[0];d=((0,1),(0,-1),(1,0),(-1,0))
def f(x,y):
if (x,y)==(g,k):ans[0]+=1;return
F[x][y]=1
for i,j in d:
nx,ny=x+i,y+j
if 0<=nx<h and 0<=ny<w and not F[nx][ny] and sum(0<=nx+ii<h and 0<=ny+jj<w and F[nx+ii][ny+jj] for ii,jj in d)==1:
f(nx,ny)
F[x][y]=0
f(s,t);print(ans[0])