結果
| 問題 |
No.2036 Max Middle
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-15 00:17:42 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 121 ms / 2,000 ms |
| コード長 | 278 bytes |
| コンパイル時間 | 289 ms |
| コンパイル使用メモリ | 82,280 KB |
| 実行使用メモリ | 120,352 KB |
| 最終ジャッジ日時 | 2024-11-30 10:16:18 |
| 合計ジャッジ時間 | 3,573 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 |
ソースコード
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)