답안 #460679

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
460679 2021-08-09T08:22:55 Z benson0402 3D Histogram (COCI20_histogram) C++14
20 / 110
5 ms 460 KB
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define F first
#define S second
#define ALL(x) x.begin(), x.end()
#define MEM(x) memset(x, 0, sizeof(x))
#define MEMS(x) memset(x, -1, sizeof(x))

#define eb emplace_back
#define ep emplace
#define mkp make_pair

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
/*------------------------------------------------------------------*/

const int N = 2005;

ll a[N], b[N];

inline void solve() {
	int n; cin >> n;
	for(int i = 0; i < n; ++i)
		cin >> a[i] >> b[i];
	ll ans = 0;
	for(int i = 0; i < n; ++i) {
		ll x = a[i], y = b[i];
		ans = max(ans, x * y);
		for(int j = i + 1; j < n; ++j) {
			x = min(x, a[j]), y = min(y, b[j]);
			ans = max(ans, x * y * (j - i + 1));
		}
	}
	cout << ans << '\n';
}

int main() {
	cin.tie(0), ios::sync_with_stdio(0);
	solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 332 KB Output is correct
2 Correct 4 ms 332 KB Output is correct
3 Correct 4 ms 332 KB Output is correct
4 Correct 3 ms 332 KB Output is correct
5 Correct 4 ms 340 KB Output is correct
6 Correct 4 ms 344 KB Output is correct
7 Correct 5 ms 332 KB Output is correct
8 Correct 3 ms 348 KB Output is correct
9 Correct 4 ms 332 KB Output is correct
10 Correct 4 ms 332 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 5 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 332 KB Output is correct
2 Correct 4 ms 332 KB Output is correct
3 Correct 4 ms 332 KB Output is correct
4 Correct 3 ms 332 KB Output is correct
5 Correct 4 ms 340 KB Output is correct
6 Correct 4 ms 344 KB Output is correct
7 Correct 5 ms 332 KB Output is correct
8 Correct 3 ms 348 KB Output is correct
9 Correct 4 ms 332 KB Output is correct
10 Correct 4 ms 332 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 5 ms 340 KB Output is correct
13 Runtime error 1 ms 460 KB Execution killed with signal 11
14 Halted 0 ms 0 KB -