Submission #32162

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
321622017-09-28 13:15:41minchurlBeads and wires (APIO14_beads)C++11
100 / 100
260 ms24164 KiB
#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);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

beads.cpp: In function 'void make_branch(long long int, long long int, long long int)':
beads.cpp:19:14: warning: unused variable 'z' [-Wunused-variable]
  LL maxx=0,y,z=0;
              ^
beads.cpp: In function 'void merge(long long int, long long int, long long int)':
beads.cpp:54:7: warning: unused variable 'z' [-Wunused-variable]
  LL y,z;
       ^
beads.cpp: In function 'void make_ans(long long int, long long int, long long int)':
beads.cpp:107:10: warning: unused variable 'y' [-Wunused-variable]
  LL i,sz,y;
          ^
beads.cpp: In function 'int main()':
beads.cpp:122:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
  ~~~~~^~~~~~~~~~~
beads.cpp:124:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld %lld %lld",&x,&y,&cost);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...