\(\text{rt}\),贺的 CF hack 区一位老哥的。
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
/// TODO: hack gp_hash_table
/// TODO: write string & long double hacks
const int SEED = 1156;
//const int DEG = 172933; // C++20x64
//const int DEG = 256279; // C++11, C++14, C++17x64
const int DEG = 218971; // C++17
//const int DEG = 202409; // for reserved 2e5
//const int DEG = 410857; // for reserved 4e5
//const int DEG = 262144; // for MSVC++17
//const int DEG = 1142821; // special bonus
int cur = 0;
int nxt() {
cur += DEG;
if (cur >= int(1e9))
cur = (cur % DEG) + 3;
return cur;
}
int comp(int a, int b) {
return a % DEG == b % DEG ? a / DEG > b / DEG : a % DEG > b % DEG;
}
int main() {
ios_base::sync_with_stdio(false);
int n = 200000 - 7;
mt19937 gen(SEED);
int skip = uniform_int_distribution<>(1, 1000000)(gen);
while (skip--)
nxt();
vector<int> v;
cout << 1 << "\n" << n << "\n";
for (int i = 0; v.size() < n && i < n; ++i) {
int cur = nxt();
v.push_back(cur);
swap(v[i], v[uniform_int_distribution<>(0, i)(gen)]);
}
//sort(all(v));
//reverse(all(v));
for (int i = 0; i < n; ++i)
cout << (i ? " " : "") << v[i];
cout << endl;
}
祝您每场 CF 赛时 hack 上大分 /cf