Submission #3552295
Source Code Expand
#include<cstring> #include<iostream> #define int long long #define inf 0x3f3f3f3f3f3f3f3f using namespace std; int n,m,a[301][301],b[301][301],c[301][301],ans; void work(){ int res=-inf; memset(c,0xcf,sizeof(c)); memset(b,0xcf,sizeof(b)); for(int i=0;i<=n;i++) for(int j=0;j<m;j++) for(int k=j+1;k<=m;k++){ res=max(res,c[j][k]-a[i][j]+a[i][k]); c[j][k]=max(c[j][k],a[i][j]-a[i][k]); ans=max(ans,b[j][k]-a[i][j]+a[i][k]); b[j][k]=max(b[j][k],res+a[i][j]-a[i][k]); } } signed main(){ cin>>n>>m; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) cin>>a[i][j],a[i][j]+=a[i-1][j]+a[i][j-1]-a[i-1][j-1]; ans=-inf; work(); swap(n,m); for(int i=0;i<=300;i++) for(int j=i;j<=300;j++) swap(a[i][j],a[j][i]); work(); cout<<ans<<endl; }
Submission Info
Submission Time | |
---|---|
Task | A - ニコニコ数 |
User | jzzcjb |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 777 Byte |
Status | RE |
Exec Time | 1390 ms |
Memory | 2432 KB |
Judge Result
Set Name | Sample | Subtask1 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 60 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt |
Subtask1 | sample_01.txt, sample_02.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | WA | 2 ms | 2432 KB |
sample_02.txt | RE | 124 ms | 2304 KB |
test_01.txt | WA | 2 ms | 2304 KB |
test_02.txt | WA | 2 ms | 2304 KB |
test_03.txt | WA | 2 ms | 2304 KB |
test_04.txt | RE | 97 ms | 2304 KB |
test_05.txt | RE | 98 ms | 2304 KB |
test_06.txt | RE | 129 ms | 2304 KB |
test_07.txt | RE | 104 ms | 2304 KB |
test_08.txt | RE | 1390 ms | 2304 KB |
test_09.txt | RE | 1390 ms | 2304 KB |
test_10.txt | RE | 810 ms | 2304 KB |
test_11.txt | RE | 1375 ms | 2304 KB |
test_12.txt | RE | 424 ms | 2304 KB |
test_13.txt | RE | 130 ms | 2304 KB |
test_14.txt | WA | 2 ms | 2304 KB |
test_15.txt | WA | 2 ms | 2432 KB |