君はまるで砂漠に咲く、一輪の花。

僕はその花に引き寄せられる蝶。

ICM Technex 2017 and Codeforces Round #400 (Div.1 + Div.2, combined)

はい。
http://codeforces.com/contest/776

A. A Serial Killer

ざっくりと大意

・ross,rachelから始まる、入力がross,joeyなのでrossが消えてjoey出現で 、joey,rachelになる。

Python3

a,b=map(str,input().split())
print(a,b)
n=int(input())
for i in range(n):
    x,y=map(str,input().split())
    if x==a: a=y
    elif x==b: b=y
    elif y==a: a=x
    else: b=y
    print(a,b)

Noteの通りのことを何となく処理。今回書いたのよりも1年前に書いてたのがもう少しマシな書き方だった。なぜだ。。。。

B. Sherlock and his girlfriend

ざっくりと大意

・n個の宝石があって、i番目の価値はi+1
・後で