比赛 EYOI与SBOI开学欢乐赛2nd 评测结果 AAAAAAAAA
题目名称 最佳游览 最终得分 100
用户昵称 00000 运行时间 0.958 s
代码语言 C++ 内存使用 5.03 MiB
提交时间 2022-09-02 21:44:52
显示代码纯文本
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,m;
int a[210][21000];
int f[21000];
int now=0;
int ans=-0x3f3f3f3f;
int main(){
	freopen("perfecttour.in","r",stdin);
	freopen("perfecttour.out","w",stdout);
cin>>n>>m;
for(int q=1;q<=n;q++)
	for(int w=1;w<m;w++)
	cin>>a[q][w];
	
	memset(f,-0x3f,sizeof(f));
	
for(int q=1;q<m;q++)
{
	for(int w=1;w<=n;w++)
	{
		f[q]=max(f[q],a[w][q]);
	}
}
for(int q=1;q<m;q++)
{
	now=0;
	for(int w=q;w<m;w++)
	{
		now+=f[w];
		ans=max(ans,now);
	}
}
cout<<ans;
//for(int q=1;q<m;q++) cout<<f[q]<<endl;
return 0;
}