Codeforces Round #530 (Div. 2) E (树形dp+线段树)

NoSuchKey