Submission #373816

# Submission time Handle Problem Language Result Execution time Memory
373816 2021-03-05T20:25:10 Z gustason Cheap flights (LMIO18_pigus_skrydziai) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
const int maxN = 3e5 + 5;
struct Pii {
    int a, w;
};
vector<Pii> adj[maxN];
vector<char> col(maxN);
vector<Pii> par(maxN);
ll sum[maxN], mx = 0;

void dfs(int v, int p) {
    col[v] = 1;
    for(auto u : adj[v]) {
        if (p == u.a) continue;
        if (col[u.a] == 0) {
            dfs(u.a, v);
        } else if (col[u.a] == 1) {
            if (par[par[u.a].a].a == v) {
                ll w = par[par[u.a].a].w + par[u.a].w + u.w;
                mx = max(mx, w);
            }
        }
        par[u.a] = {v, u.w};
    }
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    for(int i = 0; i < m; i++) {
        int a, b, w;
        cin >> a >> b >> w;
        adj[a].push_back({b, w});
        adj[b].push_back({a, w});
        sum[a] += w;
        sum[b] += w;
    }

    for(int i = 1; i <= n; i++) {
        if (col[i] == 0)
            dfs(i, -1);
    }

    for(int i = 1; i <= n; i++) {
        mx = max(mx, sum[i]);
    }

    cout << mx << "\n";
    return 0;
}

Compilation message

pigus_skrydziai.cpp:4:13: error: '::main' must return 'int'
    4 | #define int ll
      |             ^~
pigus_skrydziai.cpp:29:1: note: in expansion of macro 'int'
   29 | int main() {
      | ^~~