Submission #22248529


Source Code Expand

s = input()
n = len(s)
t = []
head = 1
for i in range(n):
    if s[i] == 'R':
        head *= -1
    else:
        if head == 1:
            if len(t) > 0 and t[len(t)-1] == s[i]:
                t.pop()
            else:
                t.append(s[i])
        else:
            if len(t) > 0 and t[0] == s[i]:
                t.pop(0)
            else:
                t.insert(0, s[i])

if head == -1:
    t.reverse()
ret = ''
for v in t:
    ret += v
print(ret)

Submission Info

Submission Time
Task D - Message from Aliens
User Arcamon
Language Python (3.8.2)
Score 0
Code Size 488 Byte
Status TLE
Exec Time 2206 ms
Memory 13832 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 2
AC × 26
TLE × 2
Set Name Test Cases
Sample 01_sample.txt, 02_sample.txt
All 01_sample.txt, 02_sample.txt, 03_random.txt, 04_random.txt, 05_random.txt, 06_random.txt, 07_random.txt, 08_random.txt, 09_random.txt, 10_random.txt, 11_random.txt, 12_random.txt, 13_random.txt, 14_random.txt, 15_random.txt, 16_random.txt, 17_random.txt, 18_random.txt, 19_random.txt, 20_random.txt, 21_random.txt, 22_random.txt, 23_max.txt, 24_max.txt, 25_max.txt, 26_max.txt, 27_max.txt, 28_max.txt
Case Name Status Exec Time Memory
01_sample.txt AC 19 ms 8856 KiB
02_sample.txt AC 23 ms 8956 KiB
03_random.txt AC 18 ms 9012 KiB
04_random.txt AC 22 ms 8860 KiB
05_random.txt AC 22 ms 8884 KiB
06_random.txt AC 1674 ms 10092 KiB
07_random.txt AC 180 ms 9236 KiB
08_random.txt AC 21 ms 8968 KiB
09_random.txt AC 83 ms 9360 KiB
10_random.txt AC 286 ms 9344 KiB
11_random.txt AC 25 ms 9080 KiB
12_random.txt AC 24 ms 9080 KiB
13_random.txt AC 30 ms 9180 KiB
14_random.txt AC 22 ms 8960 KiB
15_random.txt AC 83 ms 9004 KiB
16_random.txt AC 19 ms 8960 KiB
17_random.txt AC 17 ms 8828 KiB
18_random.txt AC 29 ms 9080 KiB
19_random.txt AC 18 ms 8956 KiB
20_random.txt AC 27 ms 9020 KiB
21_random.txt AC 36 ms 8984 KiB
22_random.txt AC 21 ms 9144 KiB
23_max.txt AC 91 ms 9784 KiB
24_max.txt AC 193 ms 9908 KiB
25_max.txt AC 313 ms 13832 KiB
26_max.txt AC 130 ms 9976 KiB
27_max.txt TLE 2206 ms 11144 KiB
28_max.txt TLE 2206 ms 12092 KiB