88038
525000372 80012714 109225034 202750922 130487539 728482754 12221732 415580934 676277240 62820
<870707 bytes omitted>
用户输出
827480
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#57589 | #1294. 小巨人 | Accepted | 100 | 607 ms | 384 K | C++ 17 / 1.5 K | 丁丁跑卡车 | 2021-07-12 21:59:56 |
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define ud unsigned int
#define ll long long
#define ull unsigned long long
#define MAX_INF 0x3f
#define MAX_INF_VAL 0x3f3f3f3f
#define MAX_INF_VAL_LL 0x3f3f3f3f3f3f3f3f
//#define pi 3.141592653589
#define eps 1e-9
#define F(x) ((x) / 3 + ((x) % 3 == 1 ? 0 : tb))
#define G(x) ((x) < tb ? (x)*3 + 1 : ((x)-tb) * 3 + 2)
//#define p 2173412051LL
//#define sz 2
using namespace std;
template <typename T>
void read(T &x) {
x = 0;
char ch = getchar();
ll f = 1;
while (!isdigit(ch)) {
if (ch == '-')
f *= -1;
ch = getchar();
}
while (isdigit(ch)) {
x = x * 10 + ch - 48;
ch = getchar();
}
x *= f;
}
struct custom_hash {
static uint64_t splitmix64(uint64_t x) {
x += 0x9e3779b97f4a7c15;
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
return x ^ (x >> 31);
}
size_t operator()(uint64_t x) const {
static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
return splitmix64(x + FIXED_RANDOM);
}
};
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int n;
int x;
stack<pair<int, int> > q;
ll ans = 0;
q.push({ 0, 1e9 + 10 });
cin >> n;
for (int i = 1; i <= n; ++i) {
cin >> x;
while (q.top().second < x) q.pop();
ans += i - q.top().first - 1;
q.push({ i, x });
}
cout << ans;
return 0;
}
88038
525000372 80012714 109225034 202750922 130487539 728482754 12221732 415580934 676277240 62820
<870707 bytes omitted>
用户输出
827480
系统信息
Exited with return code 0
579587
856853027 491128544 890854354 153519960 984791609 206048293 825864731 757030299 454709263 71
<5731544 bytes omitted>
用户输出
6654540
系统信息
Exited with return code 0
332776
20214786 25643449 85875229 669189822 786830323 78956882 896957608 316275871 996659486 112043
<3290502 bytes omitted>
用户输出
3640628
系统信息
Exited with return code 0
378106
649277098 602235533 676791970 565157587 871478991 969866980 305951880 349922654 219356112 71
<3739348 bytes omitted>
用户输出
4255686
系统信息
Exited with return code 0
50707
573885207 16269207 484510054 235771559 126486098 416813941 239447948 228122492 605078855 5606
<501320 bytes omitted>
用户输出
454772
系统信息
Exited with return code 0
718010
395903754 395576340 135364929 667873133 671849068 433013211 158510201 649491954 345164287 81
<7100232 bytes omitted>
用户输出
8739603
系统信息
Exited with return code 0
687980
359487458 74032531 780864892 968394410 12251982 7681806 193646009 858538586 146826885 130208
<6803076 bytes omitted>
用户输出
8165253
系统信息
Exited with return code 0
114647
704295242 692354435 905240998 987254045 310468104 743698300 292349193 960759587 489744508 39
<1133571 bytes omitted>
用户输出
1145186
系统信息
Exited with return code 0
781448
0 969 1941 2489 3864 4571 5811 6134 7960 7492 9437 10456 11609 12377 12968 13066 15126 14617
<7690522 bytes omitted>
用户输出
1295853917
系统信息
Exited with return code 0