Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
33599 申东铉 【S】T1 C++ 运行超时 30 1000 MS 8380 KB 481 2024-10-16 12:20:07

Tests(6/20):


#include <bits/stdc++.h> using namespace std; int n,h[2000006]; unsigned long long ans; pair <int,int> f[2000006]; int main () { cin >> n; for (int i = 1;i <= n;i++) { cin >> h[i]; } for (int i = 1;i <= n;i++) { for (int j = i;j > 1;j--) { f[j].first = max(f[j - 1].first,h[i]); f[j].second = min(f[j - 1].second,h[i]); ans = max(ans,1ull * f[j].first * f[j].second * j); } f[1] = make_pair(h[i],h[i]); } cout << ans << endl; return 0; }


测评信息: