#include "validation.h" int max_n = 300'000; int max_h = 1'000'000'000; int main(int argc, char** argv) { InputValidator v(argc, argv); int n = v.read_integer("n", 1, max_n); v.newline(); if(not v.gen) { auto h = v.read_integers("h_i", n, 1, max_h); // validating auto g = v.read_integers("h_i", n, 1, max_h); sort(begin(h), end(h)); sort(begin(g), end(g)); v.check(g == h, "The two lists are not a permutation!"); } else { auto h_method = v.get_param("h", "random"); std::vector h; if(h_method == "random") h = v.read_integers("h_i", n, 1, max_h); else if(h_method == "increasing") h = v.read_integers("h_i", n, 1, max_h, Increasing); else if(h_method == "decreasing") h = v.read_integers("h_i", n, 1, max_h, Decreasing); else if(h_method == "unique") h = v.read_integers("h_i", n, 1, max_h, Unique); // generating auto g_method = v.get_param("g", "random"); if(g_method == "random") std::shuffle(begin(h), end(h), v.rng); else if(g_method == "reverse") std::reverse(begin(h), end(h)); else if(g_method == "increasing") std::sort(begin(h), end(h)); else if(g_method == "decreasing") std::sort(rbegin(h), rend(h)); else if(g_method == "id") { } for(int i = 0; i < n; ++i) { std::cout << h[i] << " \n"[i == n - 1]; } } }