This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int maxN = 1e3*5+1;
int n, m;
vector<int> adj[maxN];
int val[maxN][maxN];
int main()
{
ios_base::sync_with_stdio(0);cin.tie(nullptr);
for(int i = 0; i < maxN; i++)for(int x = 0; x < maxN; x++)val[i][x]=-1;
cin>>n>>m;
for(int i = 0; i < m; i++){
int a, b, c;
cin>>a>>b>>c;
adj[a].push_back(b);
adj[b].push_back(a);
val[a][b]=c;
val[b][a]=c;
}
ll ans=0;
for(int i = 1; i <= n; i++){
ll temp=0;
for(auto x : adj[i]){
temp+=val[i][x];
}
ans=max(ans, temp);
}
cout<<ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |