結果

問題 No.2036 Max Middle
ユーザー みここ
提出日時 2022-12-14 04:20:00
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 409 bytes
コンパイル時間 851 ms
コンパイル使用メモリ 67,724 KB
最終ジャッジ日時 2025-02-09 11:22:58
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
typedef long long ll;

int main()
{
    int n;
    cin >> n;
    int a[200005];
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    ll ans = 0;
    int h = 0;
    for (int i = 1; i < n; i++)
    {
        if (a[i] > a[i - 1])
        {
            h++;
        }
        else
        {
            ans += h;
        }
    }
    cout << ans << endl;
}
0