Submission #183493


Source Code Expand

#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_DEPRECATE

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <fstream>
#include <iterator>

using namespace std;
const int MOD = 1000000007; // check!!!
const int INF = 100000000; //1e8

typedef long long ll;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)(c).size())
#define ten(x) ((int)1e##x)
#define tenll(x) ((ll)1e##x)

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

int h, w;
int a[101][101];
int b[101][101];

int main() {
	cin >> h >> w;
	FOR(i, h) FOR(j, w) cin >> a[i][j];
	FOR(i, h) FOR(j, w) {
		int add = a[i][j];
		if ((i + j) % 2 == 1) add *= -1;
		b[i + 1][j + 1] = b[i + 1][j] + b[i][j + 1] - b[i][j] + add;
	}

	int ans = 0;
	FOR(i, h) FOR(j, w) {
		for (int k = i + 1; k <= h; k++) {
			for (int l = j + 1; l <= w; l++) {
				int val = b[k][l] - b[i][l] - b[k][j] + b[i][j];
				if (val == 0) ans = max(ans, (k - i)*(l - j));
			}
		}
	}
	cout << ans << endl;
}

Submission Info

Submission Time
Task B - チョコレート
User math
Language C++11 (GCC 4.8.1)
Score 100
Code Size 1491 Byte
Status AC
Exec Time 130 ms
Memory 1000 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 5
AC × 25
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 130 ms 808 KB
subtask0_sample-02.txt AC 23 ms 916 KB
subtask0_sample-03.txt AC 25 ms 924 KB
subtask0_sample-04.txt AC 25 ms 800 KB
subtask0_sample-05.txt AC 24 ms 916 KB
subtask1_01.txt AC 24 ms 732 KB
subtask1_02.txt AC 24 ms 824 KB
subtask1_03.txt AC 23 ms 728 KB
subtask1_04.txt AC 22 ms 924 KB
subtask1_05.txt AC 28 ms 820 KB
subtask1_06.txt AC 26 ms 888 KB
subtask1_07.txt AC 24 ms 732 KB
subtask1_08.txt AC 24 ms 840 KB
subtask1_09.txt AC 115 ms 996 KB
subtask1_10.txt AC 39 ms 884 KB
subtask1_11.txt AC 99 ms 964 KB
subtask1_12.txt AC 96 ms 996 KB
subtask1_13.txt AC 110 ms 804 KB
subtask1_14.txt AC 115 ms 800 KB
subtask1_15.txt AC 117 ms 964 KB
subtask1_16.txt AC 94 ms 876 KB
subtask1_17.txt AC 98 ms 1000 KB
subtask1_18.txt AC 23 ms 924 KB
subtask1_19.txt AC 26 ms 800 KB
subtask1_20.txt AC 98 ms 940 KB