https://www.luogu.com.cn/paste/7vseonxz
原题面丑死了。
*修改了 1≤ki≤N1 \leq k_i \leq N1≤ki≤N 的错误,改为 0≤ki≤N0 \leq k_i \leq N0≤ki≤N。