# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
940694 | 2024-03-07T13:31:55 Z | pakapu | 3D Histogram (COCI20_histogram) | C++17 | 1 ms | 348 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Incorrect | 1 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Incorrect | 1 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |