# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
32162 | minchurl | Beads and wires (APIO14_beads) | C++11 | 260 ms | 24164 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<stdio.h>
#include<math.h>
#include<vector>
#define LL long long
#define MAX_N 200005
#define inf 1000000000000000
#define MAX(x,y) ((x)>(y)?(x):(y))
using namespace std;
struct emp{
LL y,cost;
};
LL n;
LL master[MAX_N],mid_master[MAX_N],branch[MAX_N],mid_branch[MAX_N];
vector<emp> net[MAX_N];
LL max_cost[4];
emp max_branch[4],max_master[4];
void make_branch(LL x,LL pa,LL cost){
LL i,sz;
LL maxx=0,y,z=0;
sz=net[x].size();
for(i=0;i<sz;i++){
if(net[x][i].y==pa) continue;
maxx+=mid_branch[net[x][i].y];
}
maxx=MAX(maxx,branch[x]);
for(i=0;i<sz;i++){
if(net[x][i].y==pa) continue;
y=cost+net[x][i].cost+branch[x]-mid_branch[net[x][i].y]+branch[net[x][i].y];
//printf("%lld %lld %lld %lld\n",pa,x,net[x][i].y,y);
maxx=MAX(maxx,y);
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... |