# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1092150 | ASN49K | Fireworks (APIO16_fireworks) | C++14 | 15 ms | 21664 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;
using i64=long long;
#define UNUSED -1
#define all(x) x.begin(),x.end()
#define pb push_back
const int mod=1e9+7,inf=1e9+1;
const int N=3e5;
vector<pair<int,int>>g[N];
multiset<i64>mp[N];
i64 rez[N];
void dfs(int nod)
{
if(g[nod].size()==0)
{
mp[nod].insert(0);
mp[nod].insert(0);
return;
}
for(auto &c:g[nod])
{
dfs(c.first);
int v1=*mp[c.first].rbegin();
mp[c.first].erase(mp[c.first].find(v1));
int v2=*mp[c.first].rbegin();
mp[c.first].erase(mp[c.first].find(v2));
mp[c.first].insert(v1+c.second);
mp[c.first].insert(v2+c.second);
for(auto &v:mp[c.first])
# | 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... |