Submission #183410


Source Code Expand

#define _CRT_SECURE_NO_WARNINGS
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <iterator>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pair<int,int> > vpii;
typedef long long ll; typedef vector<long long> vl; typedef pair<long long,long long> pll; typedef vector<pair<long long,long long> > vpll;
typedef vector<string> vs; typedef long double ld;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

template<typename T, int MaxH, int MaxW>
struct RectangeSum {
	T sum[MaxH+1][MaxW+1];
	template<typename U, unsigned W>
	void init(int h, int w, U a[][W]){
		rer(y, 0, h) rer(x, 0, w) sum[y][x] = (y == 0 || x == 0) ? 0 :
			sum[y-1][x] + sum[y][x-1] - sum[y-1][x-1] + a[y-1][x-1];
	}
	//[l, r), [t, b)
	inline T get(int t, int l, int b, int r) {
		return sum[b][r] - sum[b][l] - sum[t][r] + sum[t][l];
	}
};

RectangeSum<int,100,100> rsum;
int A[100][100];
int main() {
	int H, W;
	scanf("%d%d", &H, &W);
	rep(i, H) rep(j, W) {
		scanf("%d", &A[i][j]);
		if((i + j) % 2 == 1) A[i][j] *= -1;
	}
	rsum.init(H, W, A);
	int ans = 0;
	rep(i, H) rep(j, W) rer(k, i+1, H) rer(l, j+1, W)
		if(rsum.get(i, j, k, l) == 0)
			amax(ans, (k - i) * (l - j));
	printf("%d\n", ans);
    return 0;
}

Submission Info

Submission Time
Task B - チョコレート
User anta
Language C++ (G++ 4.6.4)
Score 100
Code Size 2222 Byte
Status AC
Exec Time 102 ms
Memory 924 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:59:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:61:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]

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 26 ms 796 KB
subtask0_sample-02.txt AC 23 ms 792 KB
subtask0_sample-03.txt AC 22 ms 796 KB
subtask0_sample-04.txt AC 22 ms 916 KB
subtask0_sample-05.txt AC 21 ms 796 KB
subtask1_01.txt AC 22 ms 796 KB
subtask1_02.txt AC 20 ms 920 KB
subtask1_03.txt AC 23 ms 796 KB
subtask1_04.txt AC 24 ms 920 KB
subtask1_05.txt AC 21 ms 920 KB
subtask1_06.txt AC 26 ms 920 KB
subtask1_07.txt AC 21 ms 920 KB
subtask1_08.txt AC 23 ms 840 KB
subtask1_09.txt AC 98 ms 920 KB
subtask1_10.txt AC 32 ms 916 KB
subtask1_11.txt AC 81 ms 924 KB
subtask1_12.txt AC 80 ms 920 KB
subtask1_13.txt AC 84 ms 920 KB
subtask1_14.txt AC 99 ms 924 KB
subtask1_15.txt AC 102 ms 804 KB
subtask1_16.txt AC 79 ms 920 KB
subtask1_17.txt AC 84 ms 920 KB
subtask1_18.txt AC 21 ms 920 KB
subtask1_19.txt AC 22 ms 924 KB
subtask1_20.txt AC 92 ms 812 KB