結果

問題 No.2036 Max Middle
ユーザー FromBooskaFromBooska
提出日時 2023-08-10 16:50:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 147 ms / 2,000 ms
コード長 430 bytes
コンパイル時間 471 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 120,568 KB
最終ジャッジ日時 2023-08-10 16:50:44
合計ジャッジ時間 5,013 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,264 KB
testcase_01 AC 71 ms
71,036 KB
testcase_02 AC 71 ms
71,196 KB
testcase_03 AC 72 ms
71,000 KB
testcase_04 AC 71 ms
71,376 KB
testcase_05 AC 70 ms
71,200 KB
testcase_06 AC 71 ms
71,116 KB
testcase_07 AC 70 ms
70,936 KB
testcase_08 AC 125 ms
100,704 KB
testcase_09 AC 142 ms
109,388 KB
testcase_10 AC 146 ms
113,168 KB
testcase_11 AC 133 ms
107,992 KB
testcase_12 AC 128 ms
113,288 KB
testcase_13 AC 147 ms
113,268 KB
testcase_14 AC 78 ms
76,316 KB
testcase_15 AC 78 ms
76,336 KB
testcase_16 AC 144 ms
113,200 KB
testcase_17 AC 128 ms
118,292 KB
testcase_18 AC 128 ms
120,568 KB
testcase_19 AC 130 ms
107,364 KB
testcase_20 AC 132 ms
107,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 数の間の関係を不等号<, >で表すと
# 操作で<>は><に変わる
# <<<>は><<<に変わるので、<の数を数えていく

N = int(input())
A = list(map(int, input().split()))
B = []
for i in range(1, N):
    if A[i-1] < A[i]:
        B.append('<')
    else:
        B.append('>')
        
subcount = 0
count = 0
for b in B:
    if b == '<':
        subcount += 1
    else:
        count += subcount
print(count)
0