标签:题意 getchar oid href names i++ getc etc 编号
#include<bits/stdc++.h>
using namespace std;
inline int read(){
int s=0,w=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
return s*w;
}
const int N=85;
__int128 ans,a[N][N],f[N][N][N];
inline void print(__int128 x){
if(x<0){putchar('-');x=-x;}
if(x>9)print(x/10);
putchar(x%10+'0');
}
int main(){
int n=read(),m=read();
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
a[i][j]=read();
for(int i=1;i<=n;i++){
__int128 now=1;
for(int j=1;j<=m-1;j++){
now*=2;
for(int l=1;l<=j+1;l++){
int r=l+m-j-1;
f[i][l][r]=max(f[i][l][r],max(f[i][l-1][r]+now*a[i][l-1],f[i][l][r+1]+now*a[i][r+1]));
}
}
__int128 maxn=0;
for(int j=1;j<=m;++j)maxn=max(maxn,f[i][j][j]+now*2*a[i][j]);
ans+=maxn;
}
print(ans);cout<<endl;
return 0;
}
标签:题意 getchar oid href names i++ getc etc 编号
原文地址:https://www.cnblogs.com/PPXppx/p/10992507.html