답안 #403509

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
403509 2021-05-13T09:00:09 Z NurstanDuisengaliev 3D Histogram (COCI20_histogram) C++14
20 / 110
2500 ms 3396 KB
// Nurstan Duisengaliev(REALBOY)
// Respa Gold_2022
// IZHO GOLD_2022
// IOI_2022 
/*#pragma GCC target ("avx2")
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("O3")*/                   
      
#include <bits/stdc++.h>
 
#define ll long long
#define all(x) x.begin(), x.end()
#define in insert
#define mp make_pair
#define F first
#define S second
#define ppf pop_front
#define pb push_back
#define ppb pop_back
#define pf push_front
#define pii pair <int, int>
#define pll pair <ll, ll>
#define boost() ios_base::sync_with_stdio(0), cin.tie(0)
#define sz(x) (int)x.size()
 
using namespace std;
 
const int N = (int)2e5 + 123;
const int mod = (int)1e9 + 7;
const ll INF = (ll)1e18 + 1;
int n;
ll a[N], b[N]; 
void solve () {
	cin >> n;
	for (int i = 1; i <= n; i ++) {
		cin >> a[i] >> b[i];
	}
	ll ans = 0;
	for (int i = 1; i <= n; i ++) {
		ll mini1 = mod, mini2 = mod;
		for (int j = i; j >= 1; j --) {
			mini1 = min (mini1, a[j]);
			mini2 = min (mini2, b[j]);
			ans = max (ans, mini1 * mini2 * (i - j + 1));	
		}
	}	
	cout << ans;
}   	
 
main () {
//	freopen (".in", "r", stdin);
//	freopen (".out", "w", stdout);
	boost ();
	int TT = 1;
//    cin >> TT;
	while (TT --) {
		solve ();
	}
	return 0;	                                    
}

Compilation message

histogram.cpp:52:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   52 | main () {
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 332 KB Output is correct
2 Correct 4 ms 332 KB Output is correct
3 Correct 5 ms 332 KB Output is correct
4 Correct 4 ms 360 KB Output is correct
5 Correct 4 ms 344 KB Output is correct
6 Correct 4 ms 332 KB Output is correct
7 Correct 4 ms 352 KB Output is correct
8 Correct 4 ms 356 KB Output is correct
9 Correct 4 ms 332 KB Output is correct
10 Correct 4 ms 360 KB Output is correct
11 Correct 0 ms 216 KB Output is correct
12 Correct 6 ms 360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 332 KB Output is correct
2 Correct 4 ms 332 KB Output is correct
3 Correct 5 ms 332 KB Output is correct
4 Correct 4 ms 360 KB Output is correct
5 Correct 4 ms 344 KB Output is correct
6 Correct 4 ms 332 KB Output is correct
7 Correct 4 ms 352 KB Output is correct
8 Correct 4 ms 356 KB Output is correct
9 Correct 4 ms 332 KB Output is correct
10 Correct 4 ms 360 KB Output is correct
11 Correct 0 ms 216 KB Output is correct
12 Correct 6 ms 360 KB Output is correct
13 Execution timed out 2566 ms 3396 KB Time limit exceeded
14 Halted 0 ms 0 KB -