Submission #2816374


Source Code Expand

/*
AtCoder Regular Contest 025 B - チョコレート
結果: mi
*/

//#include<stdio.h>
//#include<string.h>
//#include<math.h>
//#include<stdlib.h>
//
//#define max(x,y)(x<y?y:x)
//#define int long long
//
//int compare(const void *a, const void *b) {
//	return *(int*)b - *(int*)a;
//}
//
////尺取法
////scanf("%d", &N);
////for (i; i < N; ++i) {
////	scanf("%d", &A[i]);
////	if (b[A[i]] == 1) {
////		ans = max(ans, i - j);
////		while (b[A[i]] == 1) {
////			b[A[j++]] = 0;
////		}
////	}
////	b[A[i]] = 1;
////}
////ans = max(ans, i - j);
////printf("%d\n", ans);
//
////文字列の最大出現
////static int N, i, j, ans;
////static int A, B;
////static char A[50][51];
////static int cnt, max;
////char *max_name;
////
////scanf("%d", &N);
////for (i = 0; i < N; i++) {
////	scanf("%s", A[i]);
////}
////max_name = A[0];
////for (i = 0; i < N; i++) {
////	cnt = 0;
////	for (j = 0; j < N; j++) {
////		if (strcmp(A[i], A[j]) == 0) {
////			cnt++;
////		}
////		if (cnt > max) {
////			max = cnt;
////			max_name = A[i];
////		}
////	}
////}
////printf("%s\n", max_name);
//
////#define DEBUG1
////#define DEBUG2
//#define DEBUGF
//
//int main() {
//	//static int N, i, j, ans;
//	static int AN, BN, A[100] = {}, B[100] = {}, i, j, ans;
//	//static int A, B;
//	//static int A, B, C;
//	static int a[31] = {}, b[31] = {}, cnt = 0;
//	//static char A[50][51];
//	//static int cnt, max;
//	//char *max_name;
//	//static int ans;
//
//	scanf("%d %d", &AN, &BN);
//	for (i = 0; i < AN; i++) {
//		scanf("%d", A[i]);
//		a[A[i]]++;
//	}
//	for (i = 0; i < BN; i++) {
//		scanf("%d", B[i]);
//		b[B[i]]++;
//	}
//	for (i = 0; i < 100; i++) {
//		cnt = cnt + min(a[A[i]], b[B[i]]);
//	}
//	ans = cnt;
//	//qsort(A, N, sizeof(int), compare);
//
//	//ans = ;
//	printf("%d\n", ans);
//	//printf("%s\n", max_name);
//
//#ifdef DEBUGF
//	getch();
//#endif
//	return 0;
//}

#include<stdio.h>
int MAX(int a, int b) { return a<b ? b : a; }
int main() {
	int h, w, i, j, k, l, d[110][110], max;
	scanf("%d %d", &h, &w);
	for (i = 0; i<h; i++) {
		for (j = 0; j<w; j++) {
			scanf("%d", &k);
			d[i + 1][j + 1] = (i + j) % 2 ? -k : k;
		}
	}
	for (i = 0; i<h; i++) {
		for (j = 0; j<w; j++)d[i + 1][j + 1] += d[i][j + 1] + d[i + 1][j] - d[i][j];
	}
	for (i = max = 0; i<h; i++) {
		for (j = 0; j<w; j++) {
			for (k = i; k<h; k++) {
				for (l = j; l<w; l++) {
					if (d[k + 1][l + 1] + d[i][j] == d[k + 1][j] + d[i][l + 1])max = MAX(max, (k + 1 - i)*(l + 1 - j));
				}
			}
		}
	}
	printf("%d\n", max);
	return 0;
}

Submission Info

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

Compile Error

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

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 0 ms 128 KB
subtask0_sample-03.txt AC 1 ms 128 KB
subtask0_sample-04.txt AC 0 ms 128 KB
subtask0_sample-05.txt AC 1 ms 128 KB
subtask1_01.txt AC 0 ms 128 KB
subtask1_02.txt AC 0 ms 128 KB
subtask1_03.txt AC 0 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 1 ms 128 KB
subtask1_08.txt AC 1 ms 128 KB
subtask1_09.txt AC 47 ms 256 KB
subtask1_10.txt AC 8 ms 128 KB
subtask1_11.txt AC 36 ms 256 KB
subtask1_12.txt AC 36 ms 256 KB
subtask1_13.txt AC 36 ms 256 KB
subtask1_14.txt AC 48 ms 256 KB
subtask1_15.txt AC 49 ms 256 KB
subtask1_16.txt AC 34 ms 256 KB
subtask1_17.txt AC 38 ms 256 KB
subtask1_18.txt AC 0 ms 128 KB
subtask1_19.txt AC 1 ms 256 KB
subtask1_20.txt AC 43 ms 256 KB