#include #define MAXN 100005 #define INF 1000000000 #define MOD 1000000007 #define F first #define S second using namespace std; typedef long long ll; typedef pair P; typedef vector VI; typedef vector VVI; ll T,N,M,K; pair GetMinCut(VVI &weights) { ll N=weights.size(); VI used(N),cut,best_cut; ll best_weight=-1; for(ll phase=N-1;phase>=0;phase--) { VI w=weights[0]; VI added=used; ll prev,last=0; for(ll i=0;iw[last])) last=j; if(i==phase-1) { for(ll j=0;j>T; while(T--) { cin>>N>>M>>K; G.resize(N); for(int i=0;i p=GetMinCut(G); if(p.F>=K) puts("Yes"); else puts("No"); } return 0; }