답안 #590823

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
590823 2022-07-06T11:52:14 Z Kipras Cheap flights (LMIO18_pigus_skrydziai) C++17
0 / 100
659 ms 76056 KB
#include <bits/stdc++.h>

typedef long long ll;

using namespace std;

const ll maxN = 3e5+10;

ll n, m;
ll v[maxN]={0};
vector<ll> adj[maxN];
map<pair<ll, ll>, ll> a;

int main()
{

    ios_base::sync_with_stdio(0);cin.tie(nullptr);

    cin>>n>>m;
    for(int i = 0; i < m; i++){
        ll aa, bb, cc;
        cin>>aa>>bb>>cc;
        v[aa]+=cc;
        v[bb]+=cc;
        adj[aa].push_back(bb);
        adj[bb].push_back(aa);
        a[{aa, bb}]=cc;
        a[{bb, aa}]=cc;
    }

    ll res=0;

    for(int i = 1; i <= n; i++){
        res=max(res, v[i]);
        for(ll x = 0; x < (ll)(adj[i].size())-1; x++){
            ll v=adj[i][x], vv=adj[i][x+1];
            if(a[{i, x}]>0){
                res=max(res, a[{i, v}]+a[{i, vv}]+a[{v, vv}]);
            }
        }
    }

    cout<<res;

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 7380 KB Output is correct
2 Correct 4 ms 7380 KB Output is correct
3 Correct 4 ms 7460 KB Output is correct
4 Correct 4 ms 7384 KB Output is correct
5 Correct 4 ms 7376 KB Output is correct
6 Correct 29 ms 10452 KB Output is correct
7 Correct 4 ms 7380 KB Output is correct
8 Incorrect 3 ms 7380 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 7380 KB Output is correct
2 Correct 4 ms 7380 KB Output is correct
3 Correct 4 ms 7460 KB Output is correct
4 Correct 4 ms 7384 KB Output is correct
5 Correct 4 ms 7376 KB Output is correct
6 Correct 29 ms 10452 KB Output is correct
7 Correct 4 ms 7380 KB Output is correct
8 Incorrect 3 ms 7380 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 236 ms 38488 KB Output is correct
2 Correct 659 ms 76056 KB Output is correct
3 Incorrect 163 ms 30648 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 236 ms 38488 KB Output is correct
2 Correct 659 ms 76056 KB Output is correct
3 Incorrect 163 ms 30648 KB Output isn't correct
4 Halted 0 ms 0 KB -