Submission #1046356

# Submission time Handle Problem Language Result Execution time Memory
1046356 2024-08-06T13:26:44 Z 12345678 Cheap flights (LMIO18_pigus_skrydziai) C++17
12 / 100
3000 ms 208672 KB
#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 time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 7 ms 9560 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 1 ms 8540 KB Output is correct
12 Correct 1 ms 6492 KB Output is correct
13 Correct 1 ms 8540 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 1 ms 2392 KB Output is correct
17 Correct 0 ms 2396 KB Output is correct
18 Correct 1 ms 4636 KB Output is correct
19 Correct 1 ms 8796 KB Output is correct
20 Correct 1 ms 8540 KB Output is correct
21 Correct 0 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 7 ms 9560 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 1 ms 8540 KB Output is correct
12 Correct 1 ms 6492 KB Output is correct
13 Correct 1 ms 8540 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 1 ms 2392 KB Output is correct
17 Correct 0 ms 2396 KB Output is correct
18 Correct 1 ms 4636 KB Output is correct
19 Correct 1 ms 8796 KB Output is correct
20 Correct 1 ms 8540 KB Output is correct
21 Correct 0 ms 2396 KB Output is correct
22 Execution timed out 3069 ms 208672 KB Time limit exceeded
23 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -