0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ABC199 C - IPFL が解けた

Posted at

abc199_1.png
abc199_2.png
abc199_3.png

出来たが、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 茶色最弱問題ではあるが、なんだかスッキリしない終わり方だった。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?