Submission #996429

# Submission time Handle Problem Language Result Execution time Memory
996429 2024-06-10T15:02:21 Z otarius Designated Cities (JOI19_designated_cities) C++17
Compilation error
0 ms 0 KB
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cstring>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;

#define ff first
#define sc second
#define pb push_back
#define ll long long
#define pll pair<ll, ll>
#define pii pair <int, int>
#define ull unsigned long long

#define int long long
// #define int unsigned long long

const ll inf = 1e9 + 7;
const ll weirdMod = 998244353;

vector<pair<int, pii>> G[200005];
int n, q, val[200005], ans[200005];
void temp_dfs(int v, int par) {
    for (auto u : G[v]) {
        if (u.ff == par) continue;
        val[1] += u.sc.sc;
        temp_dfs(u.ff, v);
    }
}
void reroot_dfs(int v, int par) {
    for (auto u : G[v]) {
        if (u.ff == par) continue;
        val[u.ff] = val[v] - u.sc.sc + u.sc.ff;
        reroot_dfs(u.ff, v);
    }
}
void solve() {
    cin >> n;
    int sum = 0;
    for (int i = 1; i < n; i++) {
        int a, b, x, y;
        cin >> a >> b >> x >> y;
        G[a].pb({b, {x, y}});
        G[b].pb({a, {y, x}});
        sum += x + y;
    } temp_dfs(1, 0); reroot_dfs(1, 0);
    cin >> q >> q;
    int mx = 0;
    for (int i = 1; i <= n; i++) {
        mx = max(mx, val[i]);
    } cout << cost - mx;
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
        cout << '\n';
    }
    return 0;
}

Compilation message

designated_cities.cpp: In function 'void solve()':
designated_cities.cpp:56:15: error: 'cost' was not declared in this scope; did you mean 'cosl'?
   56 |     } cout << cost - mx;
      |               ^~~~
      |               cosl