Submission #1132492

#TimeUsernameProblemLanguageResultExecution timeMemory
1132492SpyrosAlivClosing Time (IOI23_closing)C++20
Compilation error
0 ms0 KiB
// linear network
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int n, a, b;
ll k; 
vector<int> w;
vector<ll> minX, minY;
vector<vector<pair<int, int>>> tree;

int solve_line() {
    return -1;
}

void dfs(int node, bool a, int par = -1, ll dep = 0LL) {
    if (a) minX[node] = dep;
    else minY[node] = dep;
    for (auto [next, c]: tree[node]) {
        if (next == par) continue;
        dfs(next, a, node, dep + c);
    }
}

int max_score(int sz, int x, int y, ll l, vector<int> u, vector<int> v, vector<int> weights) {
    k = l;
    n = sz;
    w = weights;
    bool line = true;
    for (int i = 0; i < n-2; i++) {
        if (v[i] != u[i] + 1) {
            line = false;
            break;
        }
    }
    if (line) return solve_line();
    else {
        tree.clear();
        tree.resize(n);
        for (int i = 0; i < n-2; i++) {
            tree[u[i]].push_back({v[i], w[i]});
            tree[v[i]].push_back({u[i], w[i]});
        }
        minX.clear();
        minX.assign(n, 0LL);
        minY.clear();
        minY.assign(n, 0LL);
        dfs(x, false);
        dfs(y, true);
        vector<ll> costs;
        for (int i = 0; i < n; i++) {
            costs.push_back(minX[i]);
            costs.push_back(minY[i]);
        }
        sort(costs.begin(), costs.end());
        int ans = 0;
        for (auto x: costs) {
            k -= x;
            if (k >= 0) ans++;
            else break;
        }
        return ans;
    }
}

int main() {
    
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccnQPq0W.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc9pgcDe.o:closing.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status