結果
問題 |
No.1687 What the Heck?
|
ユーザー |
|
提出日時 | 2021-09-24 23:45:42 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 510 ms / 2,000 ms |
コード長 | 282 bytes |
コンパイル時間 | 146 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 108,160 KB |
最終ジャッジ日時 | 2024-07-05 11:37:59 |
合計ジャッジ時間 | 5,373 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
import sys input = sys.stdin.readline from collections import * N = int(input()) P = list(map(int, input().split())) Pi = [(P[i], i+1) for i in range(N)] Pi.sort(reverse=True) ans = 0 now = N*(N+1)//2 for _, i in Pi: now -= 2*i ans = max(ans, now) now += i print(ans)