#include "bits/stdc++.h" /* #include "boost/multiprecision/cpp_int.hpp" namespace mp = boost::multiprecision; using i128=mp::cpp_int; */ using namespace std; typedef long long ll; typedef int64_t i64; typedef vector vi; typedef vector vvi; typedef vector vvvi; typedef vector vll; typedef vector vvll; typedef vector vvvll; typedef vector vs; typedef vector vc; typedef vector vvc; typedef vector vd; typedef vector vvd; #define rep(i,a,n) for(int i=a;in;i--) #define yes(ans) if(ans)cout<<"yes"<; bool bellman(ve &miti,ll s,vll &dist,ll m){ //返り値 なし(副作用 distが変わる) dist[s]=0; ll y=1; ll cnt=0; while(y){ if(cnt>m){ return 1; } y=0; for(auto i:miti){ if(dist[i.from]+i.cost>n>>m; vll d(n); rep(i,0,n) cin>>d[i]; ve miti(m); ll a,b,c; rep(i,0,m){ cin>>a>>b>>c; a--; b--; miti[i]={a,b,c-d[a]}; } vll dist(n,llINF); bool y=bellman(miti,0,dist,m); //cout<