Submission #1712240
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
template<class T>bool chmin(T&a,const T&b){return a>b?(a=b,true):false;}
template<class T>bool chmax(T&a,const T&b){return a<b?(a=b,true):false;}
int nextInt() { int x; scanf("%d", &x); return x;}
int C[110][110];
int acc[110][100];
int get(int i1, int j1, int i2, int j2) {
return acc[i2][j2] - acc[i1][j2] - acc[i2][j1] + acc[i1][j1];
}
int main2() {
int H = nextInt();
int W = nextInt();
REP(i, H) REP(j, W) {
C[i][j] = nextInt();
if ((i + j) % 2 == 1) C[i][j] *= -1;
}
memset(acc,0,sizeof(acc));
for (int i = 1; i <= H; i++) {
for (int j = 1; j <= W; j++) {
acc[i][j] = -acc[i-1][j-1] + acc[i-1][j] + acc[i][j-1] + C[i-1][j-1];
}
}
int ans = 0;
for (int i2 = 0; i2 <= H; i2++)
for (int i1 = 0; i1 < i2; i1++) {
for (int j2 = 0; j2 <= W; j2++)
for (int j1 = 0; j1 < j2; j1++) {
if (get(i1, j1, i2, j2) == 0) {
chmax(ans, (i2 - i1) * (j2 - j1));
}
}
}
cout << ans << endl;
return 0;
}
int main() {
for (;!cin.eof();cin>>ws) main2();
return 0;
}
Submission Info
Submission Time
2017-10-26 13:34:49+0900
Task
B - チョコレート
User
hs484
Language
C++14 (GCC 5.4.1)
Score
100
Code Size
1224 Byte
Status
AC
Exec Time
43 ms
Memory
384 KB
Compile Error
./Main.cpp: In function ‘int nextInt()’:
./Main.cpp:9:39: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
int nextInt() { int x; scanf("%d", &x); return x;}
^
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
100 / 100
Status
Set Name
Test Cases
Sample
subtask0_sample-01.txt, subtask0_sample-02.txt, subtask0_sample-03.txt, subtask0_sample-04.txt, subtask0_sample-05.txt
All
subtask0_sample-01.txt, subtask0_sample-02.txt, subtask0_sample-03.txt, subtask0_sample-04.txt, subtask0_sample-05.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt, subtask1_18.txt, subtask1_19.txt, subtask1_20.txt
Case Name
Status
Exec Time
Memory
subtask0_sample-01.txt
AC
2 ms
384 KB
subtask0_sample-02.txt
AC
1 ms
256 KB
subtask0_sample-03.txt
AC
1 ms
256 KB
subtask0_sample-04.txt
AC
1 ms
256 KB
subtask0_sample-05.txt
AC
1 ms
256 KB
subtask1_01.txt
AC
1 ms
256 KB
subtask1_02.txt
AC
1 ms
256 KB
subtask1_03.txt
AC
1 ms
256 KB
subtask1_04.txt
AC
1 ms
256 KB
subtask1_05.txt
AC
1 ms
256 KB
subtask1_06.txt
AC
2 ms
256 KB
subtask1_07.txt
AC
1 ms
256 KB
subtask1_08.txt
AC
1 ms
256 KB
subtask1_09.txt
AC
41 ms
384 KB
subtask1_10.txt
AC
8 ms
256 KB
subtask1_11.txt
AC
31 ms
384 KB
subtask1_12.txt
AC
31 ms
384 KB
subtask1_13.txt
AC
31 ms
384 KB
subtask1_14.txt
AC
42 ms
384 KB
subtask1_15.txt
AC
43 ms
384 KB
subtask1_16.txt
AC
30 ms
384 KB
subtask1_17.txt
AC
33 ms
384 KB
subtask1_18.txt
AC
1 ms
256 KB
subtask1_19.txt
AC
1 ms
384 KB
subtask1_20.txt
AC
33 ms
384 KB