#include using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x>N>>M; FOR(i,M) { cin>>I[0][i]>>I[1][i]>>S[i]; mat[I[0][i]][I[1][i]]=S[i]; } FOR(i,N) V[i]=i; int ma=0; do { int sc=0; FOR(x,N) FOR(y,x) sc+=mat[V[y]][V[x]]; ma=max(ma,sc); } while(next_permutation(V,V+N)); cout<