这题七个点总共跑 100ms,而小常数 O(nlogm) 一个点至少跑 400ms 才合理。
因此我推测此题没有极限数据,建议添加。
给出一个造数据的代码。
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#define fi first
#define se second
using namespace std;
using LL = long long;
using LLL = __int128;
const int MAXN = 1e6+5;
int n, k;
LL m, a[MAXN];
mt19937 rnd(random_device{}());
int main() {
freopen("lg3509.in", "w", stdout);
n = 1e6, m = 1e18;
k = rnd() % n;
uniform_int_distribution<LL> dist(1, (LL)1e18);
for (int i = 1; i <= n; ++i) {
a[i] = dist(rnd);
}
sort(a+1, a+n+1);
printf("%d %d %lld\n", n, k, m);
for (int i = 1; i <= n; ++i) printf("%lld ", a[i]);
return 0;
}