Submission #1109731

# Submission time Handle Problem Language Result Execution time Memory
1109731 2024-11-07T12:37:04 Z Trisanu_Das Tree (IOI24_tree) C++17
7 / 100
56 ms 10040 KB
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
 
const int MAX_NODES = 300005;
 
int n, child_count[MAX_NODES], leaf_count;
vector<int> parent, weight;
 
void init(const vector<int> _parent, const vector<int> _weight) {
    parent = _parent;
    weight = _weight;
    n = parent.size();
    fill(child_count, child_count + n, 0);
    leaf_count = 0;
    for (int i = 1; i < n; i++) child_count[parent[i]]++;
    for (int i = 0; i < n; i++) if (child_count[i] == 0) leaf_count++;
}
 
ll query(int left, int right) {
    return leaf_count * (ll)left + max(0LL, leaf_count * (ll)left - right);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 8392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 51 ms 10024 KB Output is correct
2 Correct 53 ms 10024 KB Output is correct
3 Correct 50 ms 10008 KB Output is correct
4 Correct 50 ms 10024 KB Output is correct
5 Correct 52 ms 10040 KB Output is correct
6 Correct 56 ms 9764 KB Output is correct
7 Correct 49 ms 10040 KB Output is correct
8 Correct 44 ms 9000 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 51 ms 10024 KB Output is correct
2 Correct 53 ms 10024 KB Output is correct
3 Correct 50 ms 10008 KB Output is correct
4 Correct 50 ms 10024 KB Output is correct
5 Correct 52 ms 10040 KB Output is correct
6 Correct 56 ms 9764 KB Output is correct
7 Correct 49 ms 10040 KB Output is correct
8 Correct 44 ms 9000 KB Output is correct
9 Incorrect 51 ms 10032 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 8508 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 34 ms 8392 KB Output isn't correct
3 Halted 0 ms 0 KB -