CF1237D Balanced Playlist
题目描述
您最爱的音乐平台 Imakf 为您专门推出了一份完美平衡的歌单,共 $n$ 首曲子,编号从 $1$ 到 $n$。您听歌是列表循环的,所以说您听完第 $i$ 首歌后,下一首会播放第 $i + 1$ 首歌,听完最后一首歌后将会从头播放。
您根据自己的感觉,为每首歌估计了一个**KUN值**,第 $i$ 首歌的KUN值是 $a_i$.
每天早上您都会从一首歌开始听,听的过程中,您就会记住您已经听的歌中最大的KUN值是多少,记为 $x$。当您听到一首KUN值严格小于 $\dfrac{x}{2}$ 的歌曲时,您会立刻砸掉播放器,以保持每天的好心情。
久而久之,您就想知道对于每一首歌 $i$ ,如果从它开始听,到停止播放之前一共可以听多少首歌?一首歌如果被重复播放,那每一次都要统计。
输入格式
无
输出格式
无
说明/提示
In the first example, here is what will happen if you start with...
- track $ 1 $ : listen to track $ 1 $ , stop as $ a_2 < \frac{a_1}{2} $ .
- track $ 2 $ : listen to track $ 2 $ , stop as $ a_3 < \frac{a_2}{2} $ .
- track $ 3 $ : listen to track $ 3 $ , listen to track $ 4 $ , listen to track $ 1 $ , stop as $ a_2 < \frac{\max(a_3, a_4, a_1)}{2} $ .
- track $ 4 $ : listen to track $ 4 $ , listen to track $ 1 $ , stop as $ a_2 < \frac{\max(a_4, a_1)}{2} $ .
In the second example, if you start with track $ 4 $ , you will listen to track $ 4 $ , listen to track $ 1 $ , listen to track $ 2 $ , listen to track $ 3 $ , listen to track $ 4 $ again, listen to track $ 1 $ again, and stop as $ a_2 < \frac{max(a_4, a_1, a_2, a_3, a_4, a_1)}{2} $ . Note that both track $ 1 $ and track $ 4 $ are counted twice towards the result.