結果

問題 No.2036 Max Middle
ユーザー tamatotamato
提出日時 2022-08-12 21:45:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 451 bytes
コンパイル時間 1,192 ms
コンパイル使用メモリ 81,580 KB
実行使用メモリ 118,372 KB
最終ジャッジ日時 2023-10-24 09:11:31
合計ジャッジ時間 2,782 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 39 ms
53,460 KB
testcase_03 AC 37 ms
53,460 KB
testcase_04 AC 36 ms
53,460 KB
testcase_05 AC 37 ms
53,460 KB
testcase_06 AC 37 ms
53,460 KB
testcase_07 AC 37 ms
53,460 KB
testcase_08 AC 83 ms
95,116 KB
testcase_09 AC 100 ms
102,300 KB
testcase_10 AC 114 ms
111,416 KB
testcase_11 AC 102 ms
118,372 KB
testcase_12 AC 99 ms
117,968 KB
testcase_13 AC 113 ms
111,824 KB
testcase_14 AC 45 ms
61,908 KB
testcase_15 AC 44 ms
61,908 KB
testcase_16 AC 112 ms
111,696 KB
testcase_17 AC 97 ms
116,108 KB
testcase_18 AC 92 ms
114,944 KB
testcase_19 AC 99 ms
117,900 KB
testcase_20 AC 102 ms
118,324 KB
権限があれば一括ダウンロードができます

ソースコード

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