Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions froglike6/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
| 9์ฐจ์‹œ | 2025.04.30 | ๊ธฐํ•˜ํ•™ | [ํ‰ํ–‰์‚ฌ๋ณ€ํ˜•](https://www.acmicpc.net/problem/1064)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/34|
| 10์ฐจ์‹œ | 2025.05.08 | ์ด๋ถ„ํƒ์ƒ‰ | [๊ฒŒ์ž„](https://www.acmicpc.net/problem/1072)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/42|
| 11์ฐจ์‹œ | 2025.05.08 | ์กฐํ•ฉ๋ก  | [High Towers](https://www.acmicpc.net/problem/33785)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/43|
| 12์ฐจ์‹œ | 2025.05.11 | ์ž๋ฃŒ ๊ตฌ์กฐ | [AC](https://www.acmicpc.net/problem/5430)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/46|
---
30 changes: 30 additions & 0 deletions froglike6/data_structure/5430.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from collections import deque
import sys
input = sys.stdin.readline

for _ in range(int(input())):
func = input().rstrip()
if int(input()) == 0:
arr = deque()
input()
else:
arr = deque(map(int, input()[1:-2].split(",")))
rev = False
err = False
for i in func:
if i == "R":
rev = not rev
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋งค์šฐ ์‚ฌ์†Œํ•œ ๊ฑด๋ฐ

rev ^= True

0, 1์„ ํ”Œ๋ฆฝํ•˜๋Š” ๊ฑฐ๋‹ค ๋ณด๋‹ˆ xor 1 ํ•ด์ฃผ๋Š” ๊ฑธ๋กœ๋„ ๊ฐ€๋Šฅํ•˜๊ธด ํ•ฉ๋‹ˆ๋‹ค ใ…Žใ…Ž

else:
if not arr:
print("error")
err = True
break
elif rev:
arr.pop()
else:
arr.popleft()

if not err:
if rev:
arr.reverse()
print(f"[{','.join(map(str, arr))}]")