#include #include #include"testlib.h" using namespace std; using ll = long long; const ll Nmin = 1, Nmax = 100'000; const ll Kmin = 1, Kmax = 100'000; const ll Cmin = 1, Cmax = 10'000'000'000LL; const ll WPmin = 1, WPmax = 100'000; int main(){ registerValidation(); ll n = inf.readLong(Nmin,Nmax); inf.readSpace(); ll k = inf.readLong(Kmin,Kmax); inf.readSpace(); ll c = inf.readLong(Cmin,Cmax); inf.readEoln(); atcoder::dsu d(n); set> es; for (ll i = 0; i < k; i++){ ll u = inf.readLong(1LL,n); inf.readSpace(); ll v = inf.readLong(1LL,n); inf.readSpace(); ll w = inf.readLong(WPmin,WPmax); inf.readSpace(); ll p = inf.readLong(WPmin,WPmax); inf.readEoln(); ensuref(u != v, "self loop"); if (u > v) swap(u,v); es.insert(pair(u,v)); u--, v--; d.merge(u,v); } ensuref((ll)(es.size()) == k, "multiple edge"); ensuref((ll)(d.size(0)) == n, "not connected"); inf.readEof(); }