版本比较
题解:P16011 [CCO 2016 Day 2] Zombie Apocalypse 僵尸启示录
正文
增加 2 行删除 2 行
23 行未改动242526272828293031322 行未改动3536373839394041424346 行未改动23 行未改动
//计算距离 ≤ d 的格子总数ll cal(int d){ if(d < 0)return 0;
//存储每个僵尸的覆盖矩形 vector<array<int, 4>> a; for(auto [r, c] : z){ int t = max(1, r - d);2 行未改动 int rr = min(m, (ll)c + d); if(t <= b && l <= rr)a.push_back({t, b, l, rr}); } if(a.empty())return 0;
//收集所有y坐标用于扫描线 vector<int> ys = {1, (int)n + 1}; for(auto [t, b, l, rr] : a){ ys.push_back(t);46 行未改动