Submission #498235

# Submission time Handle Problem Language Result Execution time Memory
498235 2021-12-24T16:10:58 Z Kipras Cheap flights (LMIO18_pigus_skrydziai) C++14
0 / 100
122 ms 199100 KB
#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
1 Correct 40 ms 98304 KB Output is correct
2 Incorrect 42 ms 98300 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 40 ms 98304 KB Output is correct
2 Incorrect 42 ms 98300 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 122 ms 199100 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 122 ms 199100 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -