結果
| 問題 |
No.2036 Max Middle
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-13 20:09:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 29 ms / 2,000 ms |
| コード長 | 425 bytes |
| コンパイル時間 | 750 ms |
| コンパイル使用メモリ | 63,388 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-14 04:08:35 |
| 合計ジャッジ時間 | 2,756 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 |
ソースコード
#include <iostream>
#include <cstdio>
using namespace std;
const int N = 200005;
int n, a[N];
int main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
long long ans = 0;
int p = n;
while (1) {
while (p > 1 && a[p] < a[p - 1])
p--;
if (p == 1) {
cout << ans << endl;
return 0;
}
ans += n - p;
p--, n--;
}
}