Submission #731596

#TimeUsernameProblemLanguageResultExecution timeMemory
731596adrilenRace (IOI11_race)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; typedef pair<int, int> pii; constexpr int maxn = 2e5; basic_string <int> children[maxn]; int d; pii dfs(int p) { vector <pii> childs; if (children[p].size() == 0) { return pii(1, 1); // Dist, num } for (int i : children[p]) { childs.emplace_back(dfs(i)); } childs.emplace_back(0, 1); sort(childs.begin(), childs.end()); pii out = pii(d + 1, 0); pii pot; while (!childs.empty()) { pot = childs.back(); childs.pop_back(); if (pot.first + out.first >= d) { out.second += pot.second; out.first = pot.first; } else break; } out.second += pot.second - 1; while (!childs.empty()) { pot = childs.back(); childs.pop_back(); out.second += pot.second - 1; } out.first ++; return out; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n >> d; int a; for (int i = 1; i < n; i++) { cin >> a; children[a].push_back(i); } int root = 0; pii output = dfs(root); cout << output.second << "\n"; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccoZEtag.o: in function `main':
race.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccBpm2hf.o:grader.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccBpm2hf.o: in function `main':
grader.cpp:(.text.startup+0x28): undefined reference to `best_path(int, int, int (*) [2], int*)'
collect2: error: ld returned 1 exit status