# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
717219 | Obada_Saleh | Beads and wires (APIO14_beads) | C++14 | 4 ms | 5076 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;
int n;
vector<pair<long long,int>>adj[200010];
long long dp1[200010],dp2[200010],dp3[200010],dp4[200010];
bool comp(pair<long long,int>x,pair<long long,int>y)
{
return x.first+dp3[x.second]-dp4[x.second]>y.first+dp3[y.second]-dp4[y.second];
}
void dfs(int node=1,int p=0)
{
for(int i=0;i<adj[node].size();i++)
{
int neighbour=adj[node][i].second;
if(neighbour==p)
{
adj[node].erase(adj[node].begin()+i);
break;
}
}
for(int i=0;i<adj[node].size();i++)
{
int neighbour=adj[node][i].second;
dfs(neighbour,node);
}
for(int i=0;i<adj[node].size();i++)
{
long long weight=adj[node][i].first;
int neighbour=adj[node][i].second;
dp4[neighbour]=dp3[neighbour];
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... |