Submission #183438


Source Code Expand

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

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#endif

using namespace std;


typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define PB push_back


#define MOD 1000000007LL
#define EPS 1e-8



int main(){
	int h, w;
	cin >> h >> w;
	int c;
	VV(int) s1, s2;
	initvv(s1, h + 1, w + 1);
	initvv(s2, h + 1, w + 1);
	
	for(int i = 1; i <= h; ++i)
	for(int j = 1; j <= w; ++j){
		cin >> c;
		(i + j & 1 ? s1 : s2)[i][j] = c;
	}
	
	for(int i = 1; i <= h; ++i)
	for(int j = 0; j <= w; ++j){
		s1[i][j] += s1[i - 1][j];
		s2[i][j] += s2[i - 1][j];
	}
	for(int i = 0; i <= h; ++i)
	for(int j = 1; j <= w; ++j){
		s1[i][j] += s1[i][j - 1];
		s2[i][j] += s2[i][j - 1];
	}
	
	int ans = 0;
	for(int y2 = 1; y2 <= h; ++y2)
	for(int y1 = 0; y1 < y2; ++y1)
	for(int x2 = 1; x2 <= w; ++x2)
	for(int x1 = 0; x1 < x2; ++x1){
		int t = s1[y2][x2] - s1[y1][x2] - s1[y2][x1] + s1[y1][x1];
		int u = s2[y2][x2] - s2[y1][x2] - s2[y2][x1] + s2[y1][x1];
		if(t == u){
			ans = max(ans, (y2 - y1) * (x2 - x1));
		}
	}
	cout << ans << endl;
}

Submission Info

Submission Time
Task B - チョコレート
User climpet
Language C++ (G++ 4.6.4)
Score 100
Code Size 2318 Byte
Status AC
Exec Time 99 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 46 ms 796 KB
subtask0_sample-02.txt AC 26 ms 880 KB
subtask0_sample-03.txt AC 21 ms 924 KB
subtask0_sample-04.txt AC 24 ms 916 KB
subtask0_sample-05.txt AC 21 ms 916 KB
subtask1_01.txt AC 23 ms 920 KB
subtask1_02.txt AC 23 ms 796 KB
subtask1_03.txt AC 23 ms 920 KB
subtask1_04.txt AC 24 ms 924 KB
subtask1_05.txt AC 25 ms 920 KB
subtask1_06.txt AC 41 ms 796 KB
subtask1_07.txt AC 24 ms 920 KB
subtask1_08.txt AC 23 ms 920 KB
subtask1_09.txt AC 98 ms 1000 KB
subtask1_10.txt AC 32 ms 916 KB
subtask1_11.txt AC 80 ms 920 KB
subtask1_12.txt AC 80 ms 916 KB
subtask1_13.txt AC 82 ms 840 KB
subtask1_14.txt AC 98 ms 796 KB
subtask1_15.txt AC 99 ms 916 KB
subtask1_16.txt AC 78 ms 924 KB
subtask1_17.txt AC 88 ms 804 KB
subtask1_18.txt AC 22 ms 716 KB
subtask1_19.txt AC 21 ms 924 KB
subtask1_20.txt AC 95 ms 852 KB