Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

25-alstjr7437 #190

Merged
merged 2 commits into from
May 22, 2024
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
3 changes: 2 additions & 1 deletion alstjr7437/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@
| 21์ฐจ์‹œ | 2024.04.06 | ๋น„ํŠธ๋งˆ์Šคํ‚น | <a href="https://www.acmicpc.net/problem/11723">์ง‘ํ•ฉ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/74 |
| 22์ฐจ์‹œ | 2024.04.13 | BFS | <a href="https://www.acmicpc.net/problem/11724">์—ฐ๊ฒฐ ์š”์†Œ์˜ ๊ฐœ์ˆ˜</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/78 |
| 23์ฐจ์‹œ | 2024.05.01 | ํ | <a href="https://school.programmers.co.kr/learn/courses/30/lessons/42587">ํ”„๋กœ์„ธ์Šค</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/79 |
| 24์ฐจ์‹œ | 2024.05.14 | BFS | <a href="https://www.acmicpc.net/problem/7576">ํ† ๋งˆํ† </a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/187 |
| 24์ฐจ์‹œ | 2024.05.14 | BFS | <a href="https://www.acmicpc.net/problem/7576">ํ† ๋งˆํ† </a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/187 |
| 25์ฐจ์‹œ | 2024.05.18 | ๋ฑ | <a href="https://www.acmicpc.net/problem/5430">AC</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/190 |
41 changes: 41 additions & 0 deletions alstjr7437/๋ฑ/AC.py
Original file line number Diff line number Diff line change
@@ -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(','))

Choose a reason for hiding this comment

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

n์ด 0์ธ ๊ฒฝ์šฐ์— ๋Œ€ํ•œ ์˜ˆ์™ธ ์ฒ˜๋ฆฌ๋งŒ ํ•ด์ฃผ๋ฉด, ๊ตณ์ด strip()์„ ์•ˆ๋ถ™์—ฌ๋„ ๋˜๊ธด ํ•ฉ๋‹ˆ๋‹ค :)

if n == 0:
    input()  # ํ•ด๋‹น ์ž…๋ ฅ์€ ๋ฒ„๋ฆผ
    x = deque()
else:
    x = deque(list(input()[1:-2].split(',')))

# ๋˜๋Š”

try:
    # n == 0์ธ ์ž…๋ ฅ์ด ์ฃผ์–ด์ง„ ๊ฒฝ์šฐ, ๋นˆ ๋ฌธ์ž์—ด์— ๋Œ€ํ•ด int๋กœ mapping ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์—๋Ÿฌ ๋ฐœ์ƒ
    x = deque(map(int, input()[1:-2].split(',')))
except: 
    x = deque()  # ์—๋Ÿฌ ๋ฐœ์ƒ ์‹œ empty deque์„ ๋Œ€์ž…

Copy link
Member

Choose a reason for hiding this comment

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

ํ—‰ ์ด๋Ÿฐ ๋ฐฉ๋ฒ•์ด................................


if n == 0 :
x = deque()

for i in p:
if i == 'R':
if temp_reverse :
temp_reverse = False
else :
temp_reverse = True
Comment on lines +20 to +23

Choose a reason for hiding this comment

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

xor์„ ์ด์šฉํ•ด ๊น”๋”ํ•˜๊ฒŒ ํ•œ ์ค„๋กœ ์ค„์—ฌ๋ด…์‹œ๋‹ค

temp_reverse ^= True

Copy link
Collaborator

Choose a reason for hiding this comment

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

๊ฐ€๋…์„ฑ์ด ์˜คํžˆ๋ ค ์ค„์ง€ ์•Š์„๊นŒ์š”..?

Copy link
Collaborator

@H0ngJu H0ngJu May 21, 2024

Choose a reason for hiding this comment

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

๋ฐ”๋กœ python temp_reverse = not tmp_reverse๋ฅผ ํ•˜๋Š”๊ฒƒ๋„?!

Copy link
Member

Choose a reason for hiding this comment

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

๋ฐ”๋กœ temp_reverse = not tmp_reverse๋ฅผ ํ•˜๋Š”๊ฒƒ๋„?!

๋™์˜ํ•ฉ๋‹ˆ๋‹ค...!


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")
Comment on lines +35 to +41

Choose a reason for hiding this comment

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

์—๋Ÿฌ์— ๋Œ€ํ•œ ์ถœ๋ ฅ ์ฒ˜๋ฆฌ๋ฅผ ์œ„๋กœ ์˜ฌ๋ ค๋ฒ„๋ฆฌ๋Š” ๊ฒŒ ๋” ๊น”๋”ํ•  ๊ฒƒ ๊ฐ™๋„ค์š”.
๋˜, ์–ด์ฐจํ”ผ ๋ฑ์— ๋“ค์–ด์žˆ๋Š” ์›์†Œ๋“ค์ด ๋ฌธ์ž์ด๊ธฐ ๋•Œ๋ฌธ์— ๋‹ค์ด๋ ‰ํŠธ๋กœ ๋ฌธ์ž์—ด join ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

if error:
    print('error')
    continue

if temp_reverse:
    x.reverse()

print(f"[{','.join(x)}]")

Copy link
Member

Choose a reason for hiding this comment

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

@wkdghdwns199 ๋™์˜ํ•ฉ๋‹ˆ๋‹ค~~~~~~~~~~~ ๋ณด๊ฐํ•ฉ๋‹ˆ๋‹ค~~~~~~~~

Choose a reason for hiding this comment

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

@wkdghdwns199 ๋™์˜ํ•ฉ๋‹ˆ๋‹ค~~~~~~~~~~~ ๋ณด๊ฐํ•ฉ๋‹ˆ๋‹ค~~~~~~~~

์™€์ด ํ™์ค€jang...?

Copy link
Member

Choose a reason for hiding this comment

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

์•— ์‹ค์ˆ˜ ใ…‹ใ…‹ใ…‹

Loading