Submission #60954688


Source Code Expand

H,W,X,Y=map(int, input().split())
S=[]
for i in range(H):
  s=input()
  S.append(s)
T=input()
xy=[[X,Y]]
x=X
y=Y
house=0
for i in range(len(T)):
  if T[i]=="U":
    if S[x-2][y-1]!="#":
      x=x-1
  if T[i]=="D":
    if S[x][y-1]!="#":
      x=x+1
  if T[i]=="L":
    if S[x-1][y-2]!="#":
      y=y-1
  if T[i]=="R":
    if S[x-1][y]!="#":
      y=y+1
  
  if S[x-1][y-1]=="@" and [x,y] not in xy:
    house+=1
    xy.append([x,y])
print(x,y,house)

Submission Info

Submission Time
Task B - Santa Claus 1
User Negipaka
Language Python (PyPy 3.10-v7.3.12)
Score 200
Code Size 476 Byte
Status AC
Exec Time 493 ms
Memory 83176 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 61 ms 80960 KiB
hand_02.txt AC 58 ms 76416 KiB
random_01.txt AC 132 ms 83176 KiB
random_02.txt AC 68 ms 81540 KiB
random_03.txt AC 67 ms 81384 KiB
random_04.txt AC 77 ms 81132 KiB
random_05.txt AC 75 ms 81436 KiB
random_06.txt AC 86 ms 82496 KiB
random_07.txt AC 74 ms 81152 KiB
random_08.txt AC 65 ms 81396 KiB
random_09.txt AC 105 ms 82540 KiB
random_10.txt AC 97 ms 82816 KiB
random_11.txt AC 63 ms 81036 KiB
random_12.txt AC 65 ms 81532 KiB
random_13.txt AC 493 ms 82564 KiB
sample_01.txt AC 57 ms 76548 KiB
sample_02.txt AC 58 ms 76572 KiB
sample_03.txt AC 60 ms 76544 KiB