#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main(int argc, char** argv){ if(argc < 6){ cerr << "Usage: " << argv[0] << " SEED K R BASEW EXTRAW\n"; return 1; } long long SEED = stoll(argv[1]); int K = stoi(argv[2]); int R = stoi(argv[3]); int BASEW = stoi(argv[4]); int EXTRAW = stoi(argv[5]); if(BASEW < 1) BASEW = 1; if(EXTRAW < 0) EXTRAW = 0; mt19937_64 rng(SEED); auto rnd = [&](int lo,int hi){ uniform_int_distribution d(lo,hi); return d(rng); }; int TMAX = 10; int CMAX = 20000; cout << R << "\n"; for(int i=1;i<=R;i++) cout << rnd(1, TMAX) << (i==R?'\n':' '); cout << K << "\n"; for(int i=1;i<=K;i++) cout << rnd(1000, CMAX) << (i==K?'\n':' '); vector> E; set> used; auto add = [&](int a,int b,int w){ if(a>b) swap(a,b); if(a==b) return; if(used.count({a,b})) return; used.insert({a,b}); E.emplace_back(a,b,w); }; for(int v=2; v<=K; ++v){ int u = rnd(1, v-1); int w = BASEW + rnd(0, EXTRAW); add(u,v,w); } int extras = max(0, K/2); while(extras--){ int a = rnd(1,K), b = rnd(1,K); if(a==b) continue; int w = BASEW + rnd(0, EXTRAW); add(a,b,w); } cout << E.size() << "\n"; for(auto &e: E){ int a,b,w; tie(a,b,w)=e; cout << a << " " << b << " " << w << "\n"; } return 0; }