# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31927 | minchurl | Beads and wires (APIO14_beads) | C++11 | 5 ms | 4992 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 MAX(x,y) ((x)>(y)?(x):(y))
#define inf 100000000000000LL
using namespace std;
struct emp{
LL y,cost;
bool operator < (emp d) const{
return cost>d.cost;
}
};
LL n;
LL t[5][MAX_N];
vector<emp> net[MAX_N];
void make_ans(LL x,LL pa,LL cost){
LL i,sz,y,max_cost[4]={-inf,-inf},sum,z=0;
sz=net[x].size();
for(i=0;i<sz;i++){
y=net[x][i].y;
if(y==pa) continue;
z++;
make_ans(y,x,net[x][i].cost);
t[0][x]+=MAX(t[0][y],MAX(t[1][y],t[2][y]));
}
if(z<1) return;
if(pa!=0){
for(i=0;i<sz;i++){
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... |