#include #include using namespace std; int N,M; int A[2525]; int a[5000],b[5000]; long c[5000]; long dist[2525]; bool upd[2525]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin>>N>>M; for(int i=0;i>A[i]; dist[i]=-1e18; } for(int i=0;i>a[i]>>b[i]>>c[i]; a[i]--,b[i]--; } dist[0]=A[0]; for(int t=1;t<=N;t++) { for(int i=0;i