跳到正文

个人记录

An unofficial tutorial on 2115C / Failure to GM

dream10约 1 分钟
原文
文章信息与版本

文章信息

发布
2025年6月2日
收录
2025年12月12日
更新
2026年11月21日
篇幅
约 1 分钟

版本

  1. v1当前

Fail to become GM.

Hints are omitted.

O(nmh2)O(nmh^2) is too simple,just use dynamic programming. dp(i,j,k)dp(i,j,k) means the probability to reach the goal in the first ii turns,min⁡(hi)=j\min(h_i)=j,∑(hi−j)=k\sum (h_i-j)=k,and make simple transitions.

As we see,the kk cound be big. And if k≤nk\leq n,we get O(nmh)O(nmh),which is fast enough.

And the kk can only be big in the beginning,and we can enumerate the time when hih_i are equal.

And set another dp,which is used frequently. g(i,j)g(i,j) means the probability to have jj times when the Sword doesn’t shine.It can be done in O(nmh)O(nmh).

So the work are done.

https://codeforces.com/contest/2115/submission/322464169

原文