Submission #15406863
Source Code Expand
# ABC158
# D - String Formation
from collections import deque
def ChangeState(Is_normal):
if Is_normal==True:
return False
else:
return True
S=deque(input().split())
Q=int(input())
Is_normal=True
for _ in range(Q):
q = input()
if len(q)== 1 :
Is_normal = ChangeState(Is_normal)
else:
if q[2]=='1':
if Is_normal==True:
# S=q[4]+S
S.appendleft(q[4])
else :
# S=S+q[4]
S.append(q[4])
else :
if Is_normal==True:
# S=S+q[4]
S.append(q[4])
else:
# S=q[4]+S
S.appendleft(q[4])
# print(Is_normal, S)
S=''.join(S)
if Is_normal==False:
S=S[::-1]
print(S)
Submission Info
| Submission Time | |
|---|---|
| Task | D - String Formation |
| User | negibose2020 |
| Language | Python (3.8.2) |
| Score | 400 |
| Code Size | 838 Byte |
| Status | AC |
| Exec Time | 288 ms |
| Memory | 12748 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 400 / 400 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | s1.txt, s2.txt, s3.txt |
| All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, s1.txt, s2.txt, s3.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01.txt | AC | 22 ms | 9336 KiB |
| 02.txt | AC | 26 ms | 9164 KiB |
| 03.txt | AC | 22 ms | 9324 KiB |
| 04.txt | AC | 28 ms | 9332 KiB |
| 05.txt | AC | 27 ms | 9172 KiB |
| 06.txt | AC | 27 ms | 9168 KiB |
| 07.txt | AC | 23 ms | 9400 KiB |
| 08.txt | AC | 31 ms | 9280 KiB |
| 09.txt | AC | 31 ms | 9180 KiB |
| 10.txt | AC | 35 ms | 9460 KiB |
| 11.txt | AC | 288 ms | 12748 KiB |
| 12.txt | AC | 280 ms | 12436 KiB |
| 13.txt | AC | 279 ms | 12672 KiB |
| 14.txt | AC | 283 ms | 12168 KiB |
| 15.txt | AC | 282 ms | 12304 KiB |
| 16.txt | AC | 283 ms | 12168 KiB |
| 17.txt | AC | 282 ms | 12348 KiB |
| 18.txt | AC | 279 ms | 12364 KiB |
| 19.txt | AC | 281 ms | 11376 KiB |
| 20.txt | AC | 282 ms | 11692 KiB |
| 21.txt | AC | 281 ms | 11380 KiB |
| s1.txt | AC | 24 ms | 9328 KiB |
| s2.txt | AC | 27 ms | 9328 KiB |
| s3.txt | AC | 28 ms | 9280 KiB |