結果
| 問題 |
No.1687 What the Heck?
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-24 21:44:09 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 560 ms / 2,000 ms |
| コード長 | 264 bytes |
| コンパイル時間 | 86 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 45,948 KB |
| 最終ジャッジ日時 | 2024-07-05 10:20:23 |
| 合計ジャッジ時間 | 5,434 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
N = int(input())
P = list(map(int, input().split()))
P_index = [[P[i], i+1] for i in range(N)]
P_index.sort(key=lambda x: x[0], reverse=True)
ans = 0
Sum = (1+N)*N//2
for i in range(N):
ans = max(ans, Sum-2*P_index[i][1])
Sum -= P_index[i][1]
print(ans)