結果

問題 No.1687 What the Heck?
ユーザー NoneNone
提出日時 2021-10-06 02:20:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 197 bytes
コンパイル時間 504 ms
コンパイル使用メモリ 87,164 KB
実行使用メモリ 109,372 KB
最終ジャッジ日時 2023-09-30 08:37:33
合計ジャッジ時間 3,700 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
71,292 KB
testcase_01 AC 79 ms
71,404 KB
testcase_02 AC 79 ms
71,312 KB
testcase_03 AC 80 ms
71,128 KB
testcase_04 AC 78 ms
71,368 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 100 ms
85,768 KB
testcase_10 AC 95 ms
82,144 KB
testcase_11 AC 94 ms
82,300 KB
testcase_12 AC 133 ms
109,364 KB
testcase_13 AC 128 ms
108,972 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0