結果

問題 No.2036 Max Middle
ユーザー lloyzlloyz
提出日時 2023-05-15 00:17:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 151 ms / 2,000 ms
コード長 278 bytes
コンパイル時間 1,163 ms
コンパイル使用メモリ 86,964 KB
実行使用メモリ 121,192 KB
最終ジャッジ日時 2023-08-20 08:54:51
合計ジャッジ時間 4,828 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
71,428 KB
testcase_01 AC 77 ms
71,248 KB
testcase_02 AC 77 ms
71,356 KB
testcase_03 AC 78 ms
71,224 KB
testcase_04 AC 79 ms
71,512 KB
testcase_05 AC 80 ms
71,636 KB
testcase_06 AC 77 ms
71,484 KB
testcase_07 AC 77 ms
71,376 KB
testcase_08 AC 118 ms
100,780 KB
testcase_09 AC 146 ms
109,800 KB
testcase_10 AC 147 ms
113,536 KB
testcase_11 AC 135 ms
108,552 KB
testcase_12 AC 136 ms
113,500 KB
testcase_13 AC 151 ms
113,604 KB
testcase_14 AC 84 ms
76,572 KB
testcase_15 AC 85 ms
76,420 KB
testcase_16 AC 145 ms
113,528 KB
testcase_17 AC 130 ms
118,116 KB
testcase_18 AC 135 ms
121,192 KB
testcase_19 AC 135 ms
107,568 KB
testcase_20 AC 136 ms
108,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))

D = []
for i in range(1, n):
    if A[i - 1] < A[i]:
        D.append('<')
    else:
        D.append('>')

ans = 0
cnt = 0
for i in range(n - 1):
    if D[i] == '<':
        cnt += 1
    else:
        ans += cnt
print(ans)
0