Codeforces Contest 1099 problem F Cookies —— 权值线段树+树形DP

NoSuchKey