Instantly share code, notes, and snippets.

@yosupo06 /maker2.cpp Secret
Created Oct 2, 2015

Embed
What would you like to do?
#include <iostream>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>
using namespace std;
typedef long long ll;
int genInt(int r) {
return rand() % r;
}
const int B = 17; // 17
int trsm[1000];
int pe[200100];
int main() {
srand(time(NULL));
//446 99681
trsm[1] = 1;
int trs = 1;
for (int i = 2; i <= B; i++) {
trsm[i] = trs + 2;
trs += trsm[i];
}
int sm = 0;
for (int i = B; i >= 1; i--) {
if (i != B) {
pe[sm] = sm - trsm[(i+1)];
}
for (int j = 1; j < trsm[i]; j++) {
pe[sm+j] = sm+j-1;
}
sm += trsm[i];
}
int n = sm;
int q = 1000000;
printf("%d %d\n", n, q);
cerr << n << endl;
for (int i = 0; i < n; i++) {
printf("%d ", genInt(20001) - 10000);
} printf("\n");
for (int i = 1; i < n; i++) {
// printf("%d %d\n", (i+1)/2, i+1);
printf("%d %d\n", pe[i]+1, i+1);
}
for (int i = 0; i < q; i++) {
int ty = genInt(2); ty++;
int a, b;
while (true) {
a = genInt(n);
b = n-1-genInt(100);
if (a != b) break;
}
a++; b++;
if (ty == 1) {
int c = genInt(20001) - 10000;
printf("%d %d %d %d\n", ty, a, b, c);
} else if (ty == 2) {
printf("%d %d %d %d\n", ty, a, b, 0);
} else {
assert(false);
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment