結果

問題 No.1687 What the Heck?
ユーザー pluto77pluto77
提出日時 2022-02-08 10:56:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 318 ms / 2,000 ms
コード長 181 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 10,612 KB
実行使用メモリ 38,440 KB
最終ジャッジ日時 2023-09-05 08:01:38
合計ジャッジ時間 5,116 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,876 KB
testcase_01 AC 15 ms
7,804 KB
testcase_02 AC 16 ms
7,816 KB
testcase_03 AC 16 ms
7,808 KB
testcase_04 AC 17 ms
7,808 KB
testcase_05 AC 15 ms
7,848 KB
testcase_06 AC 15 ms
7,764 KB
testcase_07 AC 118 ms
17,712 KB
testcase_08 AC 163 ms
23,444 KB
testcase_09 AC 113 ms
17,776 KB
testcase_10 AC 78 ms
16,692 KB
testcase_11 AC 81 ms
16,548 KB
testcase_12 AC 314 ms
38,280 KB
testcase_13 AC 314 ms
38,340 KB
testcase_14 AC 318 ms
38,296 KB
testcase_15 AC 316 ms
38,440 KB
testcase_16 AC 302 ms
37,548 KB
testcase_17 AC 34 ms
10,708 KB
testcase_18 AC 303 ms
38,336 KB
testcase_19 AC 17 ms
8,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki1687
n=int(input())
p=list(map(int,input().split()))
d={}
for i in range(n):
 d[p[i]]=i+1
s=(n+1)*n//2
res=0
for i in range(n,0,-1):
 res=max(res,s-d[i]*2)
 s-=d[i]
print(res)
0