Submission #464384

#TimeUsernameProblemLanguageResultExecution timeMemory
464384abc8641975323D Histogram (COCI20_histogram)C++17
20 / 110
2579 ms1868 KiB
/* * ## ##### #### #### # # #### * # # # # # # # # # # # # * # # ##### # # # # # # # * ###### # # # # # # ## # # # * # # # # # # # # ## ## # # * # # ##### #### #### # # #### */ #include <bits/stdc++.h> using namespace std; #define lli long long int #define mp make_pair #define pb push_back #define eb emplace_back #define pii pair <int, int> #define X first #define Y second #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define info() cerr << __PRETTY_FUNCTION__ << ": " << __LINE__ << endl void abc() {cerr << endl;} template <typename T, typename ...U> void abc(T a, U ...b) { cerr << a << ' ', abc(b...); } template <typename T> void printv(T l, T r) { while (l != r) cout << *l << " \n"[++l == r]; } template <typename A, typename B> istream& operator >> (istream& o, pair<A, B> &a) { return o >> a.X >> a.Y; } template <typename A, typename B> ostream& operator << (ostream& o, pair<A, B> a) { return o << '(' << a.X << ", " << a.Y << ')'; } template <typename T> ostream& operator << (ostream& o, vector<T> a) { bool is = false; for (T i : a) {o << (is ? ' ' : '{'), is = true, o << i;} return o << '}'; } template <typename T> struct vv : vector <vector <T>> { vv(int n, int m, T v) : vector <vector <T>> (n, vector <T>(m, v)) {} vv() {} }; template <typename T> struct vvv : vector <vv <T>> { vvv(int n, int m, int k, T v) : vector <vv <T>> (n, vv <T>(m, k, v)) {} vvv() {} }; #ifdef Doludu #define test(args...) info(), abc("[" + string(#args) + "]", args) #define owo void(0) #else #define test(args...) void(0) #define owo ios::sync_with_stdio(false); cin.tie(0) #endif const int mod = 1e9 + 7, N = 200001, logN = 18, K = 1000; int main () { owo; int n; cin >> n; vector <pii> a(n); for (int i = 0; i < n; ++i) cin >> a[i]; lli ans = 0; for (int i = 0; i < n; ++i) { int mn1 = a[i].X, mn2 = a[i].Y; ans = max(ans, 1ll * a[i].X * a[i].Y); for (int j = i + 1; j < n; ++j) { mn1 = min(mn1, a[j].X); mn2 = min(mn2, a[j].Y); ans = max(ans, 1ll * mn1 * mn2 * (j - i + 1)); } } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...