# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
934649 | LaviniaTornaghi | Fireworks (APIO16_fireworks) | C++14 | 326 ms | 60496 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>
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
typedef long long i64;
typedef __gnu_pbds::priority_queue<i64, less<i64>, binomial_heap_tag> pairing_heap;
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
int N, M; cin >> N >> M;
vector<vector<int>> adj(N);
vector<int> t(N + M);
for (int i = 1; i < N + M; i++) {
int p; cin >> p >> t[i];
adj[p - 1].push_back(i);
}
auto dfs = [&](auto &&dfs, int node) {
pairing_heap q;
if (node >= N) {
q.push(t[node]);
q.push(t[node]);
return q;
}
for (auto child: adj[node]) {
pairing_heap cq = dfs(dfs, child);
Compilation message (stderr)
# | 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... |