結果

問題 No.2036 Max Middle
ユーザー tamato
提出日時 2022-08-12 21:45:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 451 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 82,548 KB
実行使用メモリ 118,940 KB
最終ジャッジ日時 2024-09-23 01:48:49
合計ジャッジ時間 2,627 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353


def main():
    import sys
    input = sys.stdin.readline
    
    N = int(input())
    A = list(map(int, input().split()))
    
    B = []
    for i in range(N - 1):
        if A[i+1] > A[i]:
            B.append(1)
        else:
            B.append(0)
    ans = 0
    cnt_1 = 0
    for b in B:
        if b == 0:
            ans += cnt_1
        else:
            cnt_1 += 1
    print(ans)


if __name__ == '__main__':
    main()
0