Submission #940690

#TimeUsernameProblemLanguageResultExecution timeMemory
940690pakapu3D Histogram (COCI20_histogram)C++17
0 / 110
1 ms488 KiB
#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 <= prev_ans) { curr_min_a = a[i]; curr_min_b = b[i]; curr_len = 1; } ans = max(ans, curr_min_a * curr_min_b * curr_len); } cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...