用户输出
1
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#67070 | #1320. [L1-7]救火队员 | Accepted | 100 | 26 ms | 496 K | C++ 17 (Clang) / 2.2 K | Rhodoks | 2022-03-28 1:14:25 |
#include <bits/stdc++.h>
#define DB double
#define LL long long
#define MST(a, b) memset((a), (b), sizeof(a))
#ifdef _DEBUG_
#define MRK() cout << "Mark" << endl;
#define WRT(x) cout << #x << " = " << (x) << endl;
#else
#define MRK() ;
#define WRT(x) ;
#endif
#define MAXN 10100000
#define MAXM 2010000
#define MOD 998244353 // 1000000007
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define EPS 1e-5
#define _ 0
using namespace std;
namespace IO {
const int MT = 40 * 1024 * 1024; /// 40MB 请注意输入数据的大小!!!
char buf[MT];
int ptr, sz;
/// 要记得把这一行添加到main函数第一行!!!
void begin() {
ptr = 0;
sz = fread(buf, 1, MT, stdin);
}
template <typename T>
inline bool scan_d(T& t) {
while (ptr < sz && buf[ptr] != '-' && (buf[ptr] < '0' || buf[ptr] > '9')) ptr++;
if (ptr >= sz)
return false;
bool sgn = false;
if (buf[ptr] == '-')
sgn = true, ptr++;
for (t = 0; ptr < sz && '0' <= buf[ptr] && buf[ptr] <= '9'; ptr++) t = t * 10 + buf[ptr] - '0';
if (sgn)
t = -t;
return true;
}
inline bool scan_s(char s[]) {
while (ptr < sz && (buf[ptr] == ' ' || buf[ptr] == '\n')) ptr++;
if (ptr >= sz)
return false;
int len = 0;
while (ptr < sz && buf[ptr] != ' ' && buf[ptr] != '\n') s[len++] = buf[ptr], ptr++;
s[len] = '\0';
return true;
}
template <typename T>
void print(T x) {
static char s[33], *s1;
s1 = s;
if (!x)
*s1++ = '0';
if (x < 0)
putchar('-'), x = -x;
while (x) *s1++ = (x % 10 + '0'), x /= 10;
while (s1-- != s) putchar(*s1);
}
template <typename T>
void println(T x) {
print(x);
putchar('\n');
}
}; // namespace IO
void init() {}
void work() {}
int q1[MAXN], q2[MAXN];
int main() {
int n;
IO::begin();
IO::scan_d(n);
q1[0] = -1;
q2[0] = 0;
LL ans = 0;
int ptr = 0, x;
for (int i = 1; i <= n; i++) {
IO::scan_d(x);
while (x < q1[ptr]) {
// cout<<q1[ptr]<<' '<<i<<' '<<q2[ptr-1]<<endl;
ans = max(ans, (LL)q1[ptr] * (i - q2[ptr - 1] - 1));
ptr--;
}
q1[++ptr] = x;
q2[ptr] = i;
}
while (ptr) {
ans = max(ans, (LL)q1[ptr] * (n - q2[ptr] + 1));
ptr--;
}
cout << ans << endl;
return ~~(0 ^ _ ^ 0);
}
8192
60522 14575 36426 79445 48772 90081 33447 90629 3497 47202 7775 94325 63982 4784 68417 2156 319
<48151 bytes omitted>
用户输出
901408
系统信息
Exited with return code 0
8191
85925 39836 63225 34999 22439 10902 3198 53774 26740 40447 83006 28518 67297 37973 86792 80230
<48192 bytes omitted>
用户输出
1201200
系统信息
Exited with return code 0
10000
68547 24256 53097 1352 49208 27787 55371 32853 50232 66335 14396 91997 93687 85044 21626 16751
<58788 bytes omitted>
用户输出
823277
系统信息
Exited with return code 0
8192
94564 65283 16004 30238 9987 91514 57736 52928 65520 45505 31845 84075 14031 61374 85994 25599
<48080 bytes omitted>
用户输出
928620
系统信息
Exited with return code 0
8191
59453 639 55985 4685 57316 93757 24797 65975 53785 38796 92578 82666 31328 57969 19952 71686 59
<48171 bytes omitted>
用户输出
983232
系统信息
Exited with return code 0
10000
79719 33046 3578 77246 51964 1670 78656 10898 70510 32707 30807 65248 39849 60178 97957 3125 8
<58852 bytes omitted>
用户输出
997808
系统信息
Exited with return code 0