結果
問題 |
No.1687 What the Heck?
|
ユーザー |
![]() |
提出日時 | 2021-09-24 23:28:02 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 318 ms / 2,000 ms |
コード長 | 248 bytes |
コンパイル時間 | 135 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 30,120 KB |
最終ジャッジ日時 | 2024-07-05 11:35:03 |
合計ジャッジ時間 | 3,712 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
N = int(input()) A = list(map(int, input().split())) pos = [-1] * N for i, a in enumerate(A): pos[a-1] = i + 1 ans = 0 tmp = N * (N + 1) // 2 for i in reversed(range(N)): p = pos[i] ans = max(ans, tmp - 2 * p) tmp -= p print(ans)