#include #if __has_include() #include #endif // using namespace std; // using namespace atcoder; #define int long long #define rep(i, n) for(int i = 0;i<(int)(n);i++) #define all(v) (v).begin(),(v).end() using lint = long long; using ll = long long; using P = std::pair; constexpr int inf = 2e18; struct edge{int to,cost;}; bool chmin(int &a,const int b) { if(a>b) { a=b; return true; } return false; } std::vector G[110]; int dijkstra(int s,int g) { int dist[110]; std::fill(dist,dist+110,inf); dist[s]=0; std::priority_queue,std::greater

> pri; pri.push({0,s}); while(!pri.empty()) { P p = pri.top();pri.pop(); int v = p.second; if(dist[v]> n >> m; rep(i, m) { int s,t,d; std::cin >> s >> t >> d; s--,t--; G[s].push_back({t,d}); } rep(i, n) { int sum = 0; rep(j, n) sum+=dijkstra(i,j); std::cout << sum << std::endl; } return 0; }