Codeforces Round #223 (Div. 2): E. Sereja and Brackets(线段树)

NoSuchKey