Submission #482405

# Submission time Handle Problem Language Result Execution time Memory
482405 2021-10-24T12:43:12 Z rainboy 3D Histogram (COCI20_histogram) C
20 / 110
2500 ms 1716 KB
#include <stdio.h>

#define N	200000
#define INF	0x3f3f3f3f
#define LINF	0x3f3f3f3f3f3f3f3fLL

int min(int a, int b) { return a < b ? a : b; }
long long max(long long a, long long b) { return a > b ? a : b; }

int main() {
	static int aa[N], bb[N];
	int n, i, j;
	long long ans;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d%d", &aa[i], &bb[i]);
	ans = 0;
	for (i = 0; i < n; i++) {
		int a = INF, b = INF;

		for (j = i; j < n; j++) {
			a = min(a, aa[j]), b = min(b, bb[j]);
			ans = max(ans, (long long) a * b * (j - i + 1));
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Compilation message

histogram.c: In function 'main':
histogram.c:15:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
histogram.c:17:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |   scanf("%d%d", &aa[i], &bb[i]);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 204 KB Output is correct
2 Correct 6 ms 204 KB Output is correct
3 Correct 6 ms 204 KB Output is correct
4 Correct 5 ms 204 KB Output is correct
5 Correct 6 ms 296 KB Output is correct
6 Correct 6 ms 204 KB Output is correct
7 Correct 5 ms 204 KB Output is correct
8 Correct 5 ms 204 KB Output is correct
9 Correct 5 ms 308 KB Output is correct
10 Correct 5 ms 268 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 5 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 204 KB Output is correct
2 Correct 6 ms 204 KB Output is correct
3 Correct 6 ms 204 KB Output is correct
4 Correct 5 ms 204 KB Output is correct
5 Correct 6 ms 296 KB Output is correct
6 Correct 6 ms 204 KB Output is correct
7 Correct 5 ms 204 KB Output is correct
8 Correct 5 ms 204 KB Output is correct
9 Correct 5 ms 308 KB Output is correct
10 Correct 5 ms 268 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 5 ms 204 KB Output is correct
13 Execution timed out 2565 ms 1716 KB Time limit exceeded
14 Halted 0 ms 0 KB -