rt,我原本想正经的写一下二分哈希 lcs/lcp 的做法,为了检验我算答案的正确性就没写二分交上去了,结果直接过了。
建议加强数据,这是数据生成器,在保证数据强度的同时也保证能完全卡掉暴力。
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
cout << 10 << "\n";
for (int i = 1; i <= 10; ++i) {
int pos = i;
for (int j = 1; j <= 30000; ++j) {
if (j == pos) cout << "b";
else cout << "a";
}
cout << "\n";
}
return 0;
}
具体数据(是我大号):https://www.luogu.com.cn/problem/U519102
可见暴力程序需要 2.78 秒才能跑出正确答案,而且卡常也没有任何作用,常数已经是足够小的了。
为了防止以后有人卡常卡过去,建议将时限缩短到 1 秒,题解最慢的估计也就 0.5 秒,这完全不过分。
但是暴力卡掉了卡不掉套数据的用户。