ABC199 C - IPFL が解けた
5931 ワード
出来たが、WA x2 を引いてしまった。
IPFL.py
n = int(input())
S = input()
front = list(S[:n])
rear = list(S[n:])
Q = int(input())
for _ in range(Q):
t,a,b = map(int,input().split())
if t == 1:
if a <= n and b <= n:
front[a-1], front[b-1] = front[b-1], front[a-1]# <= ココ 1
elif a <= n and b > n:
front[a-1],rear[b-n-1] = rear[b-n-1],front[a-1]
elif a > n and b > n:
rear[a-n-1],rear[b-n-1] = rear[b-n-1], rear[a-n-1] # <= ココ 2
else:
front,rear = rear,front
#print(front, rear)
print("".join(front+rear))
コメントにある ココ 1 , ココ 2 を考える事が出来なかった。
diff 茶色最弱問題ではあるが、なんだかスッキリしない終わり方だった。
Author And Source
この問題について(ABC199 C - IPFL が解けた), 我々は、より多くの情報をここで見つけました https://qiita.com/AKpirion/items/c45bae11eab0727889ca著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .