結果
| 問題 | No.1687 What the Heck? |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-10-06 02:20:41 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 197 bytes |
| 記録 | |
| コンパイル時間 | 226 ms |
| コンパイル使用メモリ | 84,680 KB |
| 実行使用メモリ | 106,592 KB |
| 最終ジャッジ日時 | 2026-04-03 12:14:17 |
| 合計ジャッジ時間 | 2,340 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge5_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 8 WA * 10 |
ソースコード
N=int(input())
P=list(map(lambda x:x-1,map(int, input().split())))
Q=[0]*N
for i,p in enumerate(P):
Q[p]=i
res=0
for n in range(N)[::-1]:
res=max((n+1)*(n+2)//2 - 2*(Q[n]+1),res)
print(res)