Submission #3231533
Source Code Expand
x#include<bits/stdc++.h> using namespace std; int main(){ int h,w; cin>>h>>w; int a[111][111]={}; int b[111][111]={}; for(int i=1;i<=h;i++) for(int j=1;j<=w;j++){ if((i+j)%2)cin>>a[i][j]; else cin>>b[i][j]; } for(int i=1;i<=h;i++) for(int j=1;j<=w;j++){ a[i][j+1]+=a[i][j]; b[i][j+1]+=b[i][j]; } for(int i=1;i<=h;i++) for(int j=1;j<=w;j++){ a[j+1][i]+=a[j][i]; b[j+1][i]+=b[j][i]; } int ans=0; for(int i=1;i<=h;i++) for(int j=1;j<=w;j++) for(int k=0;k<h;k++) for(int l=0;l<w;l++){ if(i+k>h||j+l>w)continue; int asum=a[i+k][j+l]-a[i+k][j-1]-a[i-1][j+l]+a[i-1][j-1]; int bsum=b[i+k][j+l]-b[i+k][j-1]-b[i-1][j+l]+b[i-1][j-1]; if(asum==bsum)ans=max(ans,(k+1)*(l+1)); } cout<<ans<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - チョコレート |
User | shake |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 837 Byte |
Status | CE |
Compile Error
./Main.cpp:1:2: error: stray ‘#’ in program x#include<bits/stdc++.h> ^ ./Main.cpp:1:1: error: ‘x’ does not name a type x#include<bits/stdc++.h> ^ ./Main.cpp: In function ‘int main()’: ./Main.cpp:6:3: error: ‘cin’ was not declared in this scope cin>>h>>w; ^ ./Main.cpp:32:41: error: ‘max’ was not declared in this scope if(asum==bsum)ans=max(ans,(k+1)*(l+1)); ^ ./Main.cpp:34:3: error: ‘cout’ was not declared in this scope cout<<ans<<endl; ^ ./Main.cpp:34:14: error: ‘endl’ was not declared in this scope cout<<ans<<endl; ^