Submission #31939

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
319392017-09-16 11:29:27minchurlBeads and wires (APIO14_beads)C++11
0 / 100
6 ms4992 KiB
#include<stdio.h>
#include<math.h>
#include<vector>
#define LL long long
#define MAX_N 200005
#define MAX(x,y) ((x)>(y)?(x):(y))
using namespace std;
struct emp{
LL y,cost;
bool operator < (emp d) const{
return cost>d.cost;
}
};
LL n;
LL master[MAX_N],branch[MAX_N];
vector<emp> net[MAX_N];
void make_branch(LL x,LL pa,LL cost){
LL i,sz;
sz=net[x].size();
branch[pa]=MAX(branch[pa],branch[x]);
for(i=0;i<sz;i++){
if(net[x][i].y==pa) continue;
branch[pa]=MAX(branch[pa],branch[net[x][i].y]+net[x][i].cost+cost);
}
}
void merge(LL x,LL pa,LL cost){
LL i,sum,sz;
emp max_branch[3],max_master[3];
max_branch[0].cost=max_branch[1].cost=-1;
max_branch[0].y=max_branch[1].y=0;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

beads.cpp: In function 'void merge(long long int, long long int, long long int)':
beads.cpp:27:7: warning: unused variable 'sum' [-Wunused-variable]
  LL i,sum,sz;
       ^~~
beads.cpp: In function 'int main()':
beads.cpp:79:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
  ~~~~~^~~~~~~~~~~
beads.cpp:81: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...