Submission #30273351


Source Code Expand

n = int(input())
t = input()
pos = [0, 0]
d = [[1, 0], [0, -1], [-1, 0], [0, 1]]
dn = 0
for i in range(n):
    if t[i] == "S":
        pos[0] += d[dn][0]
        pos[1] += d[dn][1]
    else:
        dn += 1
        dn %= 4
print(pos[0], pos[1])

Submission Info

Submission Time
Task B - Go Straight and Turn Right
User sakakazu
Language PyPy3 (7.3.0)
Score 200
Code Size 258 Byte
Status AC
Exec Time 64 ms
Memory 65484 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 25
Set Name Test Cases
Sample example0.txt, example1.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, example0.txt, example1.txt
Case Name Status Exec Time Memory
000.txt AC 64 ms 61756 KiB
001.txt AC 52 ms 61416 KiB
002.txt AC 52 ms 61600 KiB
003.txt AC 47 ms 61712 KiB
004.txt AC 48 ms 61724 KiB
005.txt AC 49 ms 61728 KiB
006.txt AC 52 ms 63784 KiB
007.txt AC 53 ms 63980 KiB
008.txt AC 52 ms 64052 KiB
009.txt AC 54 ms 64056 KiB
010.txt AC 54 ms 64072 KiB
011.txt AC 50 ms 64040 KiB
012.txt AC 53 ms 64880 KiB
013.txt AC 53 ms 64612 KiB
014.txt AC 56 ms 64756 KiB
015.txt AC 55 ms 65176 KiB
016.txt AC 52 ms 65340 KiB
017.txt AC 55 ms 65368 KiB
018.txt AC 54 ms 64760 KiB
019.txt AC 57 ms 65484 KiB
020.txt AC 57 ms 65208 KiB
021.txt AC 56 ms 65368 KiB
022.txt AC 59 ms 65020 KiB
example0.txt AC 48 ms 61736 KiB
example1.txt AC 49 ms 61592 KiB