题解区@dingcx 大佬的题解中对于每个k=0
都会重新Θ(n)的算一遍.
所以如果m=n=2×105, k1=k2=⋯=km=0.
它就会TLE
.
所以应该在k=0的时候也把答案记下来, 这样子才是时间复杂度正确的.
数据生成器:
#include<bits/stdc++.h>
using namespace std;
int main(){
freopen("input.in", "r", stdin);
int n = 2e5, m = 2e5;
cout << n << ' ' << m << endl;
for(int i = 1; i <= n; i ++)
cout << 0 << ' ';
cout << endl;
for(int i = 1; i <= m; i ++)
cout << 0 << endl;
return 0;
}