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

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

VK Cup 2016 - Qualification Round 1

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

A. Voting for Photos

ざっくりと大意

・最多得票は誰か??

Python2

n=raw_input()
#n,k=map(int,raw_input().split())
l=map(str,raw_input().split())
d={}
ans=chk=0
for i in l:
    if i in d:
        d[i]+=1
    else:
        d[i]=1
    if d[i]>chk:
        chk=d[i]
        ans=i
print ans

票数カウントしながら最多得票が誰なのかを更新し続けて最後に出力する。

B. Chat Order

ざっくりと大意

・alexが出現で[alex]、ivanが出現して[ivan, alex]になる。romanが出現して[roman, ivan, alex]になる。ivanが出現して[ivan, roman, alex]になる。

Python2

n=int(raw_input())
l=[raw_input() for i in range(n)]
chk=set()
while len(l):
    tmp=l.pop()
    if tmp not in chk:
        print tmp
        chk.add(tmp)

TLEに苦しんだけど対策したら割りと時間余裕で通った。入力は全部リストに入れた。受取中に既出か確認しながら入れ替えとかはする必要ないと思う。受け取ったら新しい方から取り出しながら既出か確認するほうが楽だと思う。