Submission #1551578


Source Code Expand

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <limits.h>
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0);
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ll long long
#define INF 100000000
#define MOD 1000000007
#define SIZE 100005
#define FOR(i,a,n) for(i=(a);i<(n);i++)
int comp(const void* a,const void* b){
	return *(int*)a-*(int*)b;
}
int map[100][100];
int sum[100][100];
int main(void)
{
	int h,w,ans=0,t,i,j,k,l;
	scanf("%d%d",&h,&w);
	FOR(i,0,h){
		FOR(j,0,w){
			scanf("%d",&map[i][j]);
			if(i%2==j%2) map[i][j]=-map[i][j];
		}
	}
	FOR(i,0,h){
		FOR(j,0,w){
			sum[i][j]=map[i][j];
			if(i>0) sum[i][j]+=sum[i-1][j];
			if(j>0) sum[i][j]+=sum[i][j-1];
			if(i>0&&j>0) sum[i][j]-=sum[i-1][j-1];
		}
	}
	FOR(i,0,h){
		FOR(j,0,w){
			FOR(k,i,h){
				FOR(l,j,w){
					t=sum[k][l];
					if(i>0) t-=sum[i-1][l];
					if(j>0) t-=sum[k][j-1];
					if(i>0&&j>0) t+=sum[i-1][j-1];
					if(t==0) ans=MAX(ans,(k-i+1)*(l-j+1));
				}
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}
    

Submission Info

Submission Time
Task B - チョコレート
User trainstation
Language C (GCC 5.4.1)
Score 100
Code Size 1132 Byte
Status AC
Exec Time 64 ms
Memory 256 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:23:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&h,&w);
  ^
./Main.c:26:4: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d",&map[i][j]);
    ^

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 1 ms 128 KB
subtask0_sample-02.txt AC 1 ms 128 KB
subtask0_sample-03.txt AC 0 ms 128 KB
subtask0_sample-04.txt AC 1 ms 128 KB
subtask0_sample-05.txt AC 0 ms 128 KB
subtask1_01.txt AC 0 ms 128 KB
subtask1_02.txt AC 0 ms 128 KB
subtask1_03.txt AC 1 ms 128 KB
subtask1_04.txt AC 1 ms 128 KB
subtask1_05.txt AC 1 ms 128 KB
subtask1_06.txt AC 1 ms 128 KB
subtask1_07.txt AC 0 ms 128 KB
subtask1_08.txt AC 1 ms 128 KB
subtask1_09.txt AC 62 ms 256 KB
subtask1_10.txt AC 10 ms 256 KB
subtask1_11.txt AC 50 ms 256 KB
subtask1_12.txt AC 50 ms 256 KB
subtask1_13.txt AC 50 ms 256 KB
subtask1_14.txt AC 63 ms 256 KB
subtask1_15.txt AC 64 ms 256 KB
subtask1_16.txt AC 48 ms 256 KB
subtask1_17.txt AC 50 ms 256 KB
subtask1_18.txt AC 0 ms 128 KB
subtask1_19.txt AC 1 ms 256 KB
subtask1_20.txt AC 54 ms 256 KB