結果

問題 No.2036 Max Middle
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2022-08-13 04:36:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 90 ms / 2,000 ms
コード長 560 bytes
コンパイル時間 1,483 ms
コンパイル使用メモリ 168,556 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 15:51:32
合計ジャッジ時間 3,078 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 46 ms
4,348 KB
testcase_09 AC 78 ms
4,348 KB
testcase_10 AC 81 ms
4,348 KB
testcase_11 AC 68 ms
4,348 KB
testcase_12 AC 59 ms
4,348 KB
testcase_13 AC 86 ms
4,348 KB
testcase_14 AC 3 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 90 ms
4,348 KB
testcase_17 AC 35 ms
4,348 KB
testcase_18 AC 58 ms
4,348 KB
testcase_19 AC 62 ms
4,348 KB
testcase_20 AC 69 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2022.08.13 04:36:41
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;


int main() {
    int n;cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int cnt1 = 0, cnt2 = 0;
    for (int i = 0; i < n-1; i++) {
        if (a[i] < a[i+1]) cnt1++;
        else cnt2++;
    }
    ll ans = 0;
    for (int i = 0; i < n-1; i++) {
        if (a[i] < a[i+1]) ans += cnt2;
        else cnt2--;
    }
    cout << ans << endl;
    return 0;
}
0