F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_26518811_18296.cpp:1:1784: fatal error: GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/stdc++.h>usin: Invalid argument
 #include<bits/stdc++.h>using namespace std;typedef long long LL;const int MX = 1e5 + 5;struct Edge{    int v,w,nxt;}E[MX*2];int head[MX],tot,n;void init(){    memset(head,-1,sizeof(head));    tot=0;}void add(int u,int v,int w){    E[tot].v=v;    E[tot].w=w;    E[tot].nxt=head[u];    head[u]=tot++;} //¾идидëLL dir[MX];bool vis[MX];void init(int n){    for(int i=0;i<=n;i++) dir[i]=vis[i]=0;}void dfs(int u) {    vis[u]=1;    for (int i = head[u]; ~i ; i = E[i].nxt) {        if (vis[E[i].v]) continue;        int v = E[i].v , w = E[i].w;        dir[v] = dir[u] + w;        dfs(v);    }}LL dis(int u,int v){    return abs(dir[u]-dir[v]);} //¶беим¬1æ»®int q[MX];LL ans,dp[MX],p; LL dy(int j,int k){    return (dp[j]+dir[j]*dir[j])-(dp[k]+dir[k]*dir[k]);}LL dx(int j,int k){    return 2*(dir[j]-dir[k]);}LL DP(int i,int j){    return dp[j]+dis(i,j)*dis(i,j)+p;}void DFS(int u,int fa,int s,int t){    int pre=-1;    if(u!=1){        while(s<t&&dy(q[s+1],q[s])<=dir[u]*dx(q[s+1],q[s])) s++;        dp[u]=min(dp[u],DP(u,q[s]));        while(s<t&&dy(q[t],q[t-1])*dx(u,q[t])>=dy(u,q[t])*dx(q[t],q[t-1])) t--;        pre=q[++t];        q[t]=u;    }    ans=max(ans,dp[u]);    for(int i=head[u];~i;i=E[i].nxt){        int v=E[i].v;        if(v==fa) continue;        DFS(v,u,s,t);    }     if(pre!=-1) q[t]=pre;} int main(){    int T;    //freopen("in.txt","r",stdin);    scanf("%d",&T);    while(T--){        scanf("%d%d",&n,&p);        init();        init(n);        for(int i=1;i<n;i++){            int u,v,w;            scanf("%d%d%d",&u,&v,&w);            add(u,v,w);            add(v,u,w);        }        dfs(1);        for(int i=1;i<=n;i++) dp[i]=dir[i]*dir[i];        q[0]=0;ans=0;        DFS(1,0,1,0);        printf("%lld\n",ans);    }    return 0;}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ^
compilation terminated.


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-16 06:07:38, Gzip enabled