当前位置:网站首页>HNOI2003-激光炸弹
HNOI2003-激光炸弹
2022-07-22 11:07:00 【ai_moe】
题目详情
解题代码
#include<iostream>
#include<algorithm>
using namespace std;
const int N =5010;
int n,m,cnt,r;
int s[N][N];
int main()
{
scanf("%d %d",&cnt,&r);
r=min(r,5001);
m=n=r;
while(cnt --)
{
int x,y,w;
scanf("%d%d%d",&x,&y,&w);
x++,y++;
n=max(n,x),m=max(m,y);
s[x][y]+=w;
}
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
s[i][j]=s[i-1][j]+s[i][j-1]+s[i][j]-s[i-1][j-1];
int res=0;
for(int i=r;i<=n;i++)
for(int j=r;j<=m;j++)
res=max(res,s[i][j]-s[i-r][j]-s[i][j-r]+s[i-r][j-r]);
printf("%d",res);
return 0;
}
边栏推荐
- 水庫河道應急廣播系統解决方案
- JUC-7.3-线程协作-CyclicBarrier
- 锡盟蒙古族中学校园有线电视光纤传输系统设计剖析
- Seata first met
- matlab中 FFT 的意义 学习记录
- About dichotomy
- Use vis network to locate the circular toolbar according to the node coordinates
- Network Accounting - layered structure, OSI communication process, tcp/ip model and 5-layer reference model
- 水库河道应急广播系统解决方案
- Interview shock 67: talk about tcp/ip protocol? And the role of each layer?
猜你喜欢
校园IP网络广播案例-石家庄法商中等专业学校鹿泉校区校园IP广播系统应用
[lttng learning journey] ----- core concepts
Chapter 7: login using JWT token
[lttng learning journey] ----- components of lttng deconstruction
Wechat applet comprehensive case practice 2
Chapter 2: configure data sources, redis, security, swagger and other tools jar for the project
Pytoch automatic derivation
BUUCTF闯关日记03--[极客大挑战 2019]Havefun1
Buuctf breakthrough diary 04 -- [actf2020 freshman competition]include1
校园IPTV数字电视教学直播系统在淮安生态文旅区实验小学的应用
随机推荐
Script execution mode
Juc-7.2-thread collaboration condition
ssh时提示“WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED”
Bishett route - hyperspectral image classification with deep learning in pytorch environment
Makefile心得
水库河道应急广播系统解决方案
Juc-6.2-concurrency container copyonwritearraylist
小区IP网络广播背景系统解决方案-基于局域网、专网或广域网传输
Wechat applet comprehensive case practice 2
[GXYCTF2019]BabyUpload1
6. Manage servers and services
Solve the thirdscripterror error of wechat applet
Double pointer in linked list -- fast and slow pointer
[LTTng实操]------设计一套东西监控某周期运行用户程序的执行时间和周期--需求分析和方案设计
JUC-6.2-并发容器-CopyOnWriteArrayList
Buuctf entry diary -- [nctf2019]fake XML Cookbook
解决TraceCompass网站打不开和Stackoverflow显示不全的问题
JUC-7.2-线程协作-Condition
Bash basic functions - wildcards and other special symbols
[lttng learning journey] - lttng features