#include #include #include #include #define rep(i,n) for(int i=0;i> n >> m; vector i1(m),i2(m),s(m); rep(i,m) cin >> i1[i] >> i2[i] >> s[i]; vector> mat(n); rep(i,n) mat[i].assign(n,0); rep(i,m) mat[i1[i]][i2[i]] = s[i]; vector dp(1<>i)&1)){ int sum = 0; rep(j,n){ if((S>>j)&1) sum += mat[i][j]; } dp[S|(1<