Submission #60979939


Source Code Expand

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)

Submission Info

Submission Time
Task B - Santa Claus 1
User thirdon
Language Python (CPython 3.11.4)
Score 200
Code Size 716 Byte
Status AC
Exec Time 13 ms
Memory 8860 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 18
Set Name Test Cases
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
Case Name Status Exec Time Memory
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