답안 #590825

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
590825 2022-07-06T11:54:59 Z Kipras Cheap flights (LMIO18_pigus_skrydziai) C++17
컴파일 오류
0 ms 0 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.count({i, x}>0})){
                res=max(res, a[{i, v}]+a[{i, vv}]+a[{v, vv}]);
            }
        }
    }

    cout<<res;

    return 0;
}

Compilation message

pigus_skrydziai.cpp: In function 'int main()':
pigus_skrydziai.cpp:37:30: error: expected ')' before '>' token
   37 |             if(a.count({i, x}>0})){
      |                       ~      ^
      |                              )
pigus_skrydziai.cpp:37:32: error: expected ')' before '}' token
   37 |             if(a.count({i, x}>0})){
      |               ~                ^
      |                                )
pigus_skrydziai.cpp:37:32: error: expected primary-expression before '}' token
pigus_skrydziai.cpp:36:16: warning: unused variable 'v' [-Wunused-variable]
   36 |             ll v=adj[i][x], vv=adj[i][x+1];
      |                ^
pigus_skrydziai.cpp:36:29: warning: unused variable 'vv' [-Wunused-variable]
   36 |             ll v=adj[i][x], vv=adj[i][x+1];
      |                             ^~
pigus_skrydziai.cpp:37:33: error: expected primary-expression before ')' token
   37 |             if(a.count({i, x}>0})){
      |                                 ^
pigus_skrydziai.cpp: At global scope:
pigus_skrydziai.cpp:43:5: error: 'cout' does not name a type
   43 |     cout<<res;
      |     ^~~~
pigus_skrydziai.cpp:45:5: error: expected unqualified-id before 'return'
   45 |     return 0;
      |     ^~~~~~
pigus_skrydziai.cpp:46:1: error: expected declaration before '}' token
   46 | }
      | ^