# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28972 | 2017-07-18T02:31:24 Z | 시제연(#1229) | Triumphal arch (POI13_luk) | C++11 | 1303 ms | 25192 KB |
#include <bits/stdc++.h> using namespace std; int n, t; vector<int> lis[300100]; int d[300100]; void dfs(int here, int p) { int i, sum = 0; for (auto &there : lis[here]) { if (there==p) continue; dfs(there,here); sum += d[there]; } d[here] = max(sum-t+1,1); } int main() { int i; scanf("%d",&n); for (i=0;i<n-1;i++) { int a, b; scanf("%d%d",&a,&b); --a; --b; lis[a].push_back(b); lis[b].push_back(a); } int s = 0, e = n; while(s<=e) { int m = (s+e)>>1; t = m; dfs(0,-1); if (d[0]>1) s = m+1; else e = m-1; } printf("%d\n",s); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 10224 KB | Output is correct |
2 | Correct | 3 ms | 10224 KB | Output is correct |
3 | Correct | 3 ms | 10224 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 10224 KB | Output is correct |
2 | Correct | 0 ms | 10224 KB | Output is correct |
3 | Correct | 3 ms | 10224 KB | Output is correct |
4 | Correct | 0 ms | 10224 KB | Output is correct |
5 | Correct | 3 ms | 10224 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 10224 KB | Output is correct |
2 | Correct | 0 ms | 10224 KB | Output is correct |
3 | Correct | 3 ms | 10224 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 10224 KB | Output is correct |
2 | Correct | 3 ms | 10224 KB | Output is correct |
3 | Correct | 0 ms | 10224 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 10620 KB | Output is correct |
2 | Correct | 6 ms | 10716 KB | Output is correct |
3 | Correct | 6 ms | 10620 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 33 ms | 11280 KB | Output is correct |
2 | Correct | 33 ms | 11948 KB | Output is correct |
3 | Correct | 23 ms | 11412 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 239 ms | 13524 KB | Output is correct |
2 | Correct | 239 ms | 15260 KB | Output is correct |
3 | Correct | 69 ms | 13924 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 756 ms | 16824 KB | Output is correct |
2 | Correct | 719 ms | 21288 KB | Output is correct |
3 | Correct | 143 ms | 17632 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 996 ms | 20124 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1303 ms | 20124 KB | Output is correct |
2 | Correct | 1266 ms | 25192 KB | Output is correct |
3 | Correct | 443 ms | 21160 KB | Output is correct |