# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
1186000 | | gyg | Tree (IOI24_tree) | C++20 | | 53 ms | 16932 KiB |
#include "tree.h"
#include <bits/stdc++.h>
using namespace std;
#define sig signed
#define int long long
#define arr array
#define vec vector
#define pii pair<int, int>
#define fir first
#define sec second
const int N = 2e5 + 5;
int n;
arr<vec<int>, N> ch;
arr<int, N> wg;
int nm;
void init(vec<sig> _pr, vec<sig> _wg) {
n = _pr.size();
for (int u = 1; u <= n; u++)
ch[_pr[u - 1] + 1].push_back(u);
for (int u = 1; u <= n; u++)
wg[u] = _wg[u - 1];
for (int u = 1; u <= n; u++)
nm += ch[u].empty();
}
int query(sig l, sig r) {
int ans = nm * l + max(nm * l - r, 0ll);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |