#include #include #include #include using namespace std; struct edge { int from, to, cost; }; vector G0, rG; vector cost0, rcost; int main(void) { constexpr int inf = 1; int n, m; scanf("%d%d", &n, &m); int a, b, c; for(int i=0; i cost0[e.from] + e.cost) { cost0[e.to] = cost0[e.from] + e.cost; update = true; } } if(!update) { break; } } int days = -cost0[n-1]; // rcost.assign(n, inf); // rcost[n-1] = 0; // while(true) { // bool update = false; // for(int i=0; i rcost[e.from] + e.cost) { // rcost[e.to] = rcost[e.from] + e.cost; // update = true; // } // } // if(!update) { break; } // } // // int cnt = 0; // for(int i=0; i