# include <cstdio> # include <cstring> # include <cstdlib> # include <iostream> # include <vector> # include <queue> # include <stack> # include <map> # include <set> # include <cmath> # include…
#include<cstdio> #include<iostream> #include<cstring> #define M 100000 #define inf 2139062143 using namespace std; struct data { int l,r,w; }a[M]; *M],u[*M],v[*M],cnt=,n,m,K,ans; ,head1[M],next1[*M],fro[*M],u1[*M],v1[*M],w1[*M],f[M],fr[M…