Submission #1018510

#TimeUsernameProblemLanguageResultExecution timeMemory
1018510vjudge1Birokracija (COCI18_birokracija)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int M = 2e5 + 1; int subt[M],ans[M]; vector<int> nei[M]; void dfs(int u) { subt[u]=1; for (int i:nei[u]) { dfs(i); ans[u]+=ans[i]; subt[u]+=subt[i]; } ans[u]+=subt[u]; } int main() { int n; cin>>n; for (int i=2;i<=n;i++) { int u; cin>>u; nei[u].push_back(i); } dfs(1); for (int i=1;i<=n;i++) cout<<ans[i]<<' '; cout<<endl; return 0; }

Compilation message (stderr)

cc1plus: error: '::main' must return 'int'