結果
| 問題 | No.1687 What the Heck? |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-10-06 02:20:41 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 197 bytes |
| 記録 | |
| コンパイル時間 | 240 ms |
| コンパイル使用メモリ | 95,600 KB |
| 実行使用メモリ | 115,968 KB |
| 最終ジャッジ日時 | 2026-08-23 17:27:18 |
| 合計ジャッジ時間 | 3,590 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)