#include #include #define repeat(i,n) for (int i = 0; (i) < (n); ++(i)) template bool setmax(T & l, T const & r) { if (not (l < r)) return false; l = r; return true; } using namespace std; int main() { int n, m; cin >> n >> m; vector > score(n, vector(n)); repeat (i,m) { int x, y, z; cin >> x >> y >> z; score[x][y] = z; } vector dp(1<