Submission #735141

#TimeUsernameProblemLanguageResultExecution timeMemory
735141Farhan_HY3D Histogram (COCI20_histogram)C++14
20 / 110
2557 ms6060 KiB
#include <bits/stdc++.h> #define int long long #define F first #define S second #define T int tc; cin >> tc; while(tc--) #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); using namespace std; const int inf = 1e18; const int N = 1e6 + 5; const int M = 505; const int LOG = 32; const int CHAR = 26; const int mod = 1e9 + 7; const int mod2 = 998244353; const float pi = atan(1) * 4; const int dx[] = {1, 0, 0, -1}; const int dy[] = {0, -1, 1, 0}; const char d[] = {'E', 'N', 'S', 'W'}; int n, a[N], b[N]; main() { IOS cin >> n; for(int i = 1; i <= n; i++) cin >> a[i] >> b[i]; int ans = 0; for(int i = 1; i <= n; i++) { int mnA = a[i], mnB = b[i]; for(int j = i; j <= n; j++) { mnA = min(mnA, a[j]); mnB = min(mnB, b[j]); ans = max(ans, mnA * mnB * (j - i + 1)); } } cout << ans; }

Compilation message (stderr)

histogram.cpp:21:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   21 | main() {
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...