結果

問題 No.2928 Gridpath
ユーザー prd_xxxprd_xxx
提出日時 2024-10-12 16:56:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
MLE  
実行時間 -
コード長 673 bytes
コンパイル時間 396 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 782,848 KB
最終ジャッジ日時 2024-10-12 16:56:27
合計ジャッジ時間 3,934 ms
ジャッジサーバーID
(参考情報)
judge5 / judge
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,752 KB
testcase_01 AC 27 ms
10,752 KB
testcase_02 MLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**8)
H,W = map(int,input().split())
si,sj = map(lambda x:int(x)-1,input().split())
gi,gj = map(lambda x:int(x)-1,input().split())

D = {'R':(0,1), 'D':(1,0), 'L':(0,-1), 'U':(-1,0)}
R = {'R':'L', 'D':'U', 'L':'R', 'U':'D', '_':'*'}
S = {'R':'UD', 'D':'LR', 'L':'UD', 'U':'LR', '_':''}

ans = 0
def rec(i,j,p,pp):
    global ans
    if (i,j)==(gi,gj):
        ans += 1
        return
    for d,(di,dj) in D.items():
        if d==R[p]: continue
        ni,nj = i+di,j+dj
        if not (0<=ni<H and 0<=nj<W): continue
        np,npp = d,p
        if R[d]==pp and p in S[d]: continue
        rec(ni,nj,np,npp)
rec(si,sj,'_','_')

print(ans)
0