Submission #1111780

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
11117802024-11-12 20:40:09Kirill22File Paths (BOI15_fil)C++17
100 / 100
112 ms5020 KiB
#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});
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...