捞 求调 25pts 线段树

P8818 [CSP-S 2022] 策略游戏

数组开成 1e5 后现在 40pts.......
by 流水行船CCD @ 2023-07-10 11:28:32


过了,死因: 求 tmp 的时候要分类讨论,直接枚举会挂掉! 应该改成这样: ```cpp ll tmp=-1e18; if(bn>=0&&Na.first.first>=0){ tmp=max(tmp,bn*Na.first.first); }else if(bn<0&&Na.second.second<INF){ tmp=max(tmp,bn*Na.second.second); } if(bx>=0&&Na.second.first>-INF){ tmp=max(tmp,bx*Na.second.first); }else if(bx<0&&Na.first.second<0){ tmp=max(tmp,bx*Na.first.second); } cout<<tmp<<endl; ```
by 流水行船CCD @ 2023-07-10 11:39:42


|