Submission #1046356

#TimeUsernameProblemLanguageResultExecution timeMemory
104635612345678Cheap flights (LMIO18_pigus_skrydziai)C++17
12 / 100
3069 ms208672 KiB
#include <bits/stdc++.h> using namespace std; const int nx=5e3+5; #define ll long long ll n, m, dist[nx][nx], u, v, w, dp[nx], mx; vector<tuple<ll, ll, ll>> d; int main() { cin.tie(NULL)->sync_with_stdio(false); cin>>n>>m; for (int i=1; i<=m; i++) cin>>u>>v>>w, dist[u][v]=w, dist[v][u]=w, d.push_back({u, v, w}), dp[u]+=w, dp[v]+=w; for (int i=1; i<=n; i++) mx=max(mx, dp[i]); for (auto [u, v, w]:d) for (int i=1; i<=n; i++) if (dist[u][i]!=0&&dist[v][i]!=0) mx=max(mx, w+dist[u][i]+dist[v][i]); cout<<mx; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...