# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1111780 | Kirill22 | File Paths (BOI15_fil) | C++17 | 112 ms | 5020 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h"
using namespace std;
void solve() {
int n, m, k, s;
cin >> n >> m >> k >> s;
s++;
vector<int> p(n + 1, -1), l(n + 1, 1);
vector<vector<int>> g(n + 1);
for (int i = 1; i <= n; i++) {
cin >> p[i] >> l[i];
l[i] = l[i] + 1 + l[p[i]];
g[p[i]].push_back(i);
}
unordered_set<int> have;
for (int i = 0; i <= n; i++) {
have.insert(l[i] + s);
}
vector<int> ans(m);
vector<vector<pair<int, int>>> qu(n + 1);
for (int q = 0; q < m; q++) {
int pr, len;
cin >> pr >> len;
len = k - len - l[pr];
bool ok = false;
if (len == 0) {
ok = true;
}
qu[pr].push_back({q, len});
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |