結果

問題 No.2411 Reverse Directions
ユーザー hiryuNhiryuN
提出日時 2023-08-11 22:33:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,066 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 103,980 KB
最終ジャッジ日時 2024-04-29 13:36:27
合計ジャッジ時間 7,693 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 43 ms
52,096 KB
testcase_02 RE -
testcase_03 AC 43 ms
52,224 KB
testcase_04 WA -
testcase_05 AC 42 ms
51,968 KB
testcase_06 AC 42 ms
52,224 KB
testcase_07 RE -
testcase_08 AC 42 ms
51,968 KB
testcase_09 AC 42 ms
52,480 KB
testcase_10 WA -
testcase_11 RE -
testcase_12 WA -
testcase_13 AC 51 ms
61,056 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 AC 44 ms
52,352 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 59 ms
63,872 KB
testcase_24 WA -
testcase_25 AC 51 ms
60,288 KB
testcase_26 AC 48 ms
59,008 KB
testcase_27 RE -
testcase_28 WA -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

h,w,k,l,r=map(int,input().split())
X=[]
for i in range(h):
	s=input()
	S=[str(c) for c in s]
	X.append(S)
if r==k or (r+l)%2==0 or k%2!=0:
	print("No")
	exit()
X[0][0]=1
ex=[[0,0]]
point=0
while point!=len(ex):
    II=ex[point]
    now=X[II[0]][II[1]]
    for I in [[1,0],[-1,0],[0,1],[0,-1]]:
        if 0<=II[0]+I[0]<h and 0<=II[1]+I[1]<w:
            if X[II[0]+I[0]][II[1]+I[1]]==".":
                X[II[0]+I[0]][II[1]+I[1]]=now+1
                ex.append([II[0]+I[0],II[1]+I[1]])
    point+=1
if X[-1][-1]>k-r+l-1:
    print("No")
    exit()
ans=""
#print(X)
II=[h-1,w-1]
point=X[-1][-1]
VM=["","L","","U","D","","R"]
for i in reversed(range(point)):
    for I in [[1,0],[-1,0],[0,1],[0,-1]]:
        if 0<=II[0]+I[0]<h and 0<=II[1]+I[1]<w:
            if X[II[0]+I[0]][II[1]+I[1]]==i:
                II=[II[0]+I[0],II[1]+I[1]]
                key=I[0]+3*I[1]
                #print(key,I)
                ans=ans+VM[key]
                break

print("Yes")
print(ans[:l],end="")
print((ans[l]+VM[-VM.index(ans[l])])*((k-len(ans))//2),end="")
print(ans[l:])
0