# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
940694 | pakapu | 3D Histogram (COCI20_histogram) | C++17 | 1 ms | 348 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
int n;
cin >> n;
vector<int> a(n);
vector<int> b(n);
for (int i = 0; i < n; i++) {
cin >> a[i] >> b[i];
}
int curr_len = 1;
int curr_min_a = a[0];
int curr_min_b = b[0];
int prev_ans = a[0] * b[0];
int ans = a[0] * b[0];
for (int i = 1; i < n; i++) {
curr_min_a = min(curr_min_a, a[i]);
curr_min_b = min(curr_min_b, b[i]);
curr_len++;
if (curr_min_a * curr_min_b * curr_len <= a[i] * b[i]) {
curr_min_a = a[i];
curr_min_b = b[i];
curr_len = 1;
}
ans = max(ans, curr_min_a * curr_min_b * curr_len);
prev_ans = curr_min_a * curr_min_b * curr_len;
}
cout << ans << '\n';
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |