結果

問題 No.2036 Max Middle
ユーザー FromBooskaFromBooska
提出日時 2023-05-19 17:48:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 394 bytes
コンパイル時間 306 ms
コンパイル使用メモリ 86,636 KB
実行使用メモリ 120,404 KB
最終ジャッジ日時 2023-08-22 21:53:07
合計ジャッジ時間 5,197 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,068 KB
testcase_01 AC 75 ms
71,280 KB
testcase_02 AC 74 ms
71,328 KB
testcase_03 AC 74 ms
71,220 KB
testcase_04 AC 74 ms
71,288 KB
testcase_05 AC 76 ms
71,132 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 129 ms
120,404 KB
testcase_19 WA -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

# 公式解説の方法をもう一度やる

N = int(input())
A = list(map(int, input().split()))
signs = []
for i in range(1, N):
    if A[i] > A[i-1]:
        signs.append(+1)
    else:
        signs.append(-1)

count = 0
subcount = 0
for i in range(N-1):
    if signs[i] == 1:
        subcount += 1
    elif signs[i] == -1:
        count += subcount
        subcount = 1
print(count)






0