版本比较
[CWOI Round 3 C] 题解
正文
增加 5 行删除 5 行
37 行未改动3839404142424344454647474849505174 行未改动12612712812913013013113213313413513613613713813914018 行未改动1591601611621631631641651661672 行未改动37 行未改动 sou(y,x),++son[x]; }}bool cmp(int xx,int yy){ return xx > yy; return xx > yy;}void DP(int x,int father){ if(son[x] == 0){ for(int i = 1;i <= n+1;++i) dp[x][i] = a[x]; return; return; } if(son[x] == 1){//显然只有一个儿子的时候只能走下去 for(int i = head[x];i;i = next1[i]){ int y = to[i];74 行未改动 return qsort(1,r-l+1,k);}void sou(int x,int father,int c){ int tot = 0,qx = r;//duck love frog dp[x] = a[x]; dp[x] = a[x]; for(int i = head[x];i;i = next1[i]){ int y = to[i]; if(y == father) continue; ++tot; } if(tot == 0) return; if(tot == 0) return; if(tot == 1){ for(int i = head[x];i;i = next1[i]){ int y = to[i]; if(y == father) continue;18 行未改动 for(int i = 1;i <= n;++i) cin >> a[i]; for(int i = 1;i < n;++i){ cin >> aa >> bb; add(aa,bb),add(bb,aa); } } sou(1,-1,0); cout << dp[1]; return 0;}2 行未改动