Codeforces Round #541 (Div. 2) D. Gourmet choice(并查集+拓扑) F. Asya And Kittens(启发式合并+链表)

NoSuchKey