提出 #60979939


ソースコード 拡げる

h,w,x,y=map(int,input().split())
s=[]
for i in range(h):
  s.append(input())
t=input()
count=0
x-=1
y-=1
for i in range(len(t)):
  if t[i]=='L':
    y-=1
    if s[x][y]=='@':
      count+=1
      s[x]=s[x][:y]+'.'+s[x][y+1:]
    elif s[x][y]=='#':
      y+=1
  elif t[i]=='R':
    y+=1
    if s[x][y]=='@':
      count+=1
      s[x]=s[x][:y]+'.'+s[x][y+1:]
    elif s[x][y]=='#':
      y-=1    
  elif t[i]=='U':
    x-=1
    if s[x][y]=='@':
      count+=1
      s[x]=s[x][:y]+'.'+s[x][y+1:]
    elif s[x][y]=='#':
      x+=1
  elif t[i]=='D':
    x+=1
    if s[x][y]=='@':
      count+=1
      s[x]=s[x][:y]+'.'+s[x][y+1:]
    elif s[x][y]=='#':
      x-=1
print(x+1,y+1,count)

提出情報

提出日時
問題 B - Santa Claus 1
ユーザ thirdon
言語 Python (CPython 3.11.4)
得点 200
コード長 716 Byte
結果 AC
実行時間 13 ms
メモリ 8860 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 3
AC × 18
セット名 テストケース
Sample sample_01.txt, sample_02.txt, sample_03.txt
All hand_01.txt, hand_02.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, sample_01.txt, sample_02.txt, sample_03.txt
ケース名 結果 実行時間 メモリ
hand_01.txt AC 13 ms 8832 KiB
hand_02.txt AC 10 ms 8800 KiB
random_01.txt AC 13 ms 8776 KiB
random_02.txt AC 12 ms 8788 KiB
random_03.txt AC 11 ms 8788 KiB
random_04.txt AC 13 ms 8756 KiB
random_05.txt AC 12 ms 8856 KiB
random_06.txt AC 13 ms 8764 KiB
random_07.txt AC 12 ms 8816 KiB
random_08.txt AC 11 ms 8824 KiB
random_09.txt AC 13 ms 8848 KiB
random_10.txt AC 12 ms 8848 KiB
random_11.txt AC 11 ms 8784 KiB
random_12.txt AC 11 ms 8788 KiB
random_13.txt AC 13 ms 8724 KiB
sample_01.txt AC 10 ms 8776 KiB
sample_02.txt AC 10 ms 8780 KiB
sample_03.txt AC 10 ms 8860 KiB