版本比较
Red-Blue Operations (Hard Version)
正文
增加 2 行删除 2 行
31 行未改动323334353636373839406 行未改动4748495051515253545522 行未改动31 行未改动
【操作】完后,会发现所有数相同了,这时再对 $n$ 个数整体进行【操作】。
答案:$k+mi-\lceil \frac{(k-n)/2-(s-mi\times n)}{n} \rceil$。
#### 若 $k \bmod 2\ne n\bmod 2$:
会多出一次操作。这东西很恶心,会令【最终加】少一次。考虑舍弃 $a_n$ 的【最终加】。
6 行未改动```cpp#include<bits/stdc++.h>#define int long longusing namespace std;
signed main(){ ios::sync_with_stdio(false); cin.tie(0),cout.tie(0);22 行未改动