답안 #592201

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
592201 2022-07-08T18:23:21 Z Kipras Cheap flights (LMIO18_pigus_skrydziai) C++17
0 / 100
594 ms 63048 KB
#include <bits/stdc++.h>

typedef long long ll;

using namespace std;

const ll maxN = 5e5+10;

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

int main()
{

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

    for(ll i = 0; i < maxN; i++)v[i]=0;

    cin>>n>>m;
    for(ll 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(ll i = 1; i <= n; i++){
        res=max(res, v[i]);
        for(ll x = 0; x < ((ll)(adj[i].size()))-1; x++){
            ll vv=adj[i][x], vvv=adj[i][x+1];
            if(a.count({i, x})){
                res=max(res, a[{i, vv}]+a[{i, vvv}]+a[{vv, vvv}]);
            }
        }
    }

    cout<<res;

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 15956 KB Output is correct
2 Correct 9 ms 15956 KB Output is correct
3 Correct 8 ms 15956 KB Output is correct
4 Correct 9 ms 15876 KB Output is correct
5 Correct 8 ms 15956 KB Output is correct
6 Correct 39 ms 18908 KB Output is correct
7 Correct 7 ms 15956 KB Output is correct
8 Incorrect 10 ms 15892 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 15956 KB Output is correct
2 Correct 9 ms 15956 KB Output is correct
3 Correct 8 ms 15956 KB Output is correct
4 Correct 9 ms 15876 KB Output is correct
5 Correct 8 ms 15956 KB Output is correct
6 Correct 39 ms 18908 KB Output is correct
7 Correct 7 ms 15956 KB Output is correct
8 Incorrect 10 ms 15892 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 273 ms 44056 KB Output is correct
2 Correct 594 ms 63048 KB Output is correct
3 Incorrect 180 ms 31548 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 273 ms 44056 KB Output is correct
2 Correct 594 ms 63048 KB Output is correct
3 Incorrect 180 ms 31548 KB Output isn't correct
4 Halted 0 ms 0 KB -