From 6b830f06de980bbef2858915ab1c3fb61f532724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=AF=BC=EC=84=9D=7CMinseok=20Kim?= Date: Sat, 18 May 2024 18:25:31 +0900 Subject: [PATCH 1/2] =?UTF-8?q?2024-05-18=20=EB=AC=B8=EC=A0=9C=20=EC=84=A0?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- alstjr7437/README.md | 3 ++- "alstjr7437/\355\236\231/AC.py" | 0 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 "alstjr7437/\355\236\231/AC.py" diff --git a/alstjr7437/README.md b/alstjr7437/README.md index c132ba86..9a91aff6 100644 --- a/alstjr7437/README.md +++ b/alstjr7437/README.md @@ -25,4 +25,5 @@ | 21차시 | 2024.04.06 | 비트마스킹 | 집합 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/74 | | 22차시 | 2024.04.13 | BFS | 연결 요소의 개수 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/78 | | 23차시 | 2024.05.01 | 큐 | 프로세스 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/79 | -| 24차시 | 2024.05.14 | BFS | 토마토 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/187 | \ No newline at end of file +| 24차시 | 2024.05.14 | BFS | 토마토 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/187 | +| 25차시 | 2024.05.18 | 힙 | AC | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/190 | \ No newline at end of file diff --git "a/alstjr7437/\355\236\231/AC.py" "b/alstjr7437/\355\236\231/AC.py" new file mode 100644 index 00000000..e69de29b From 0f376b130cd6b2ece8823ae5ca33720f347fc642 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=AF=BC=EC=84=9D=7CMinseok=20Kim?= Date: Sat, 18 May 2024 19:06:19 +0900 Subject: [PATCH 2/2] 2024-05-18 solved --- alstjr7437/README.md | 2 +- "alstjr7437/\353\215\261/AC.py" | 41 +++++++++++++++++++++++++++++++++ "alstjr7437/\355\236\231/AC.py" | 0 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 "alstjr7437/\353\215\261/AC.py" delete mode 100644 "alstjr7437/\355\236\231/AC.py" diff --git a/alstjr7437/README.md b/alstjr7437/README.md index 9a91aff6..de60cec6 100644 --- a/alstjr7437/README.md +++ b/alstjr7437/README.md @@ -26,4 +26,4 @@ | 22차시 | 2024.04.13 | BFS | 연결 요소의 개수 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/78 | | 23차시 | 2024.05.01 | 큐 | 프로세스 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/79 | | 24차시 | 2024.05.14 | BFS | 토마토 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/187 | -| 25차시 | 2024.05.18 | 힙 | AC | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/190 | \ No newline at end of file +| 25차시 | 2024.05.18 | 덱 | AC | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/190 | \ No newline at end of file diff --git "a/alstjr7437/\353\215\261/AC.py" "b/alstjr7437/\353\215\261/AC.py" new file mode 100644 index 00000000..3bbb6479 --- /dev/null +++ "b/alstjr7437/\353\215\261/AC.py" @@ -0,0 +1,41 @@ +from collections import deque +import sys +input = sys.stdin.readline + +t = int(input()) + +for _ in range(t): + temp_reverse = False + error = 0 + + p = input() + n = int(input()) + x = deque(input().strip()[1:-1].split(',')) + + if n == 0 : + x = deque() + + for i in p: + if i == 'R': + if temp_reverse : + temp_reverse = False + else : + temp_reverse = True + + if i == "D": + if len(x) == 0: + error = 1 + break + else : + if temp_reverse : + x.pop() + else : + x.popleft() + + if temp_reverse : + x.reverse() + + if error == 0 : + print(f"[{','.join(str(i) for i in x)}]") + else : + print("error") diff --git "a/alstjr7437/\355\236\231/AC.py" "b/alstjr7437/\355\236\231/AC.py" deleted file mode 100644 index e69de29b..00000000