Codeforces Round #620 F2. Animal Observation (hard version) (dp + 线段树)

NoSuchKey