-
Notifications
You must be signed in to change notification settings - Fork 2
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
25-alstjr7437 #190
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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(',')) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. xor์ ์ด์ฉํด ๊น๋ํ๊ฒ ํ ์ค๋ก ์ค์ฌ๋ด ์๋ค temp_reverse ^= True There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๊ฐ๋ ์ฑ์ด ์คํ๋ ค ์ค์ง ์์๊น์..? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๋ฐ๋ก There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
๋์ํฉ๋๋ค...! |
||
|
||
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ์๋ฌ์ ๋ํ ์ถ๋ ฅ ์ฒ๋ฆฌ๋ฅผ ์๋ก ์ฌ๋ ค๋ฒ๋ฆฌ๋ ๊ฒ ๋ ๊น๋ํ ๊ฒ ๊ฐ๋ค์. if error:
print('error')
continue
if temp_reverse:
x.reverse()
print(f"[{','.join(x)}]") There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wkdghdwns199 ๋์ํฉ๋๋ค~~~~~~~~~~~ ๋ณด๊ฐํฉ๋๋ค~~~~~~~~ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
์์ด ํ์คjang...? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ์ ์ค์ ใ ใ ใ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
n์ด 0์ธ ๊ฒฝ์ฐ์ ๋ํ ์์ธ ์ฒ๋ฆฌ๋ง ํด์ฃผ๋ฉด, ๊ตณ์ด strip()์ ์๋ถ์ฌ๋ ๋๊ธด ํฉ๋๋ค :)