Submission #498235

#TimeUsernameProblemLanguageResultExecution timeMemory
498235KiprasCheap flights (LMIO18_pigus_skrydziai)C++14
0 / 100
122 ms199100 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...