# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
62637 | 2018-07-29T15:03:07 Z | win11905 | Birokracija (COCI18_birokracija) | C++11 | 258 ms | 29724 KB |
#include <bits/stdc++.h> using namespace std; #define long long long const int N = 2e5+5; int n; long ans[N]; vector<int> g[N]; void dfs(int u) { for(int v : g[u]) dfs(v), ans[u] += ans[v]; } int main() { fill_n(ans, N, 1); scanf("%d", &n); for(int i = 2, p; i <= n; ++i) { scanf("%d", &p); g[p].emplace_back(i); } dfs(1), dfs(1); for_each(ans+1, ans+n+1, [](long x) { printf("%lld ", x); }); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 6520 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 6760 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 6760 KB | Output is correct |
2 | Correct | 9 ms | 6760 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 6796 KB | Output is correct |
2 | Correct | 12 ms | 6856 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 6856 KB | Output is correct |
2 | Correct | 12 ms | 6972 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 7360 KB | Output is correct |
2 | Correct | 23 ms | 7864 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 82 ms | 8928 KB | Output is correct |
2 | Correct | 48 ms | 9640 KB | Output is correct |
3 | Correct | 41 ms | 11028 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 195 ms | 13232 KB | Output is correct |
2 | Correct | 136 ms | 16816 KB | Output is correct |
3 | Correct | 111 ms | 29724 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 258 ms | 29724 KB | Output is correct |
2 | Correct | 133 ms | 29724 KB | Output is correct |
3 | Correct | 130 ms | 29724 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 208 ms | 29724 KB | Output is correct |
2 | Correct | 120 ms | 29724 KB | Output is correct |
3 | Correct | 155 ms | 29724 KB | Output is correct |