版本比较
[JZOI 2024] Spring_Training 官方题解
正文
增加 11 行删除 11 行
59 行未改动6061626364646566676868697070717273747576777778798081818283848529 行未改动115116117118119119120121122123276 行未改动全部展开400401402403404404405406407408117 行未改动全部展开52652752852953053053153253353410 行未改动5455465475485495495505515525538 行未改动56256356456556656656756856957054 行未改动625626627628629629630631632633139 行未改动全部展开59 行未改动 } if(xi[ord]==0) xi[ord]=num; else p[ord]=num; if(f[i-1]=='x') p[ord]=1;
for(int j=1;j<=ord;j++) { xi[j]*=p[j]; p[j]-=1; p[j]-=1; }
for(int j=1;j<=ord;j++) { if(j==1 && p[j]<0) cout<<0; if(p[j]<0) continue; if(p[j]==0) cout<<xi[j]; if(p[j]==1) cout<<xi[j]<<"x"; if(p[j]>1) cout<<xi[j]<<"x"<<"^"<<p[j]; if(p[j]>1) cout<<xi[j]<<"x"<<"^"<<p[j]; if(p[j+1]>=0 && xi[j+1]!=0) cout<<"+"; } return 0;} }```
## [B](https://www.luogu.com.cn/problem/T453854) ##
29 行未改动
```cppbool check(int mid){ for(int i = 0; i <= 359 - mid; i++){ if(deg[i] && deg[i + mid]) return 1; if(deg[i] && deg[i + mid]) return 1; } return 0;}```276 行未改动全部展开 query(l, r, ans, 1, n, 1); qprint(work(ans), 2); } }
return 0;}```
117 行未改动全部展开 if(a[j - 1] > a[j] && a[j - 1] < k) p[i][0] += a[j] - a[j - 1]; } for(int j = prem[i] - 1; j >= prem[i - 1] + 1; j--){ if(a[j + 1] < a[j] && a[j + 1] >= k) p[i][1] += a[j] - a[j + 1]; if(a[j + 1] > a[j] && a[j + 1] < k) p[i][1] += a[j] - a[j + 1]; if(a[j + 1] > a[j] && a[j + 1] < k) p[i][1] += a[j] - a[j + 1]; } } f[n] = p[n][0]; f[n - 1] = p[n - 1][0];10 行未改动}
int main(){ rd();
ll l = 0, r = 1e12, mid; ll ans = 0, ret; while(l <= r){ mid = (l + r) >> 1;8 行未改动 } } qprint(ans, 2); return 0;
}```
## [D](https://www.luogu.com.cn/problem/T440097) ##54 行未改动用 $f_{u,1}$ 表示在固定以 $root$ 为根时,$u$ 的所有兄弟节点的 $f_{i,0} + w$ 的最大值。
用 $r_u$ 表示换根时,从 $u$ 的父节点的所需邮件数的最大值。
用 $dp_u$ 表示以 $u$ 为根时,所需最小邮件数。 用 $dp_u$ 表示以 $u$ 为根时,所需最小邮件数。
因此写出状态转移方程。
```cpp139 行未改动全部展开