結果

問題 No.1687 What the Heck?
ユーザー 👑 timitimi
提出日時 2021-09-28 09:45:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 182 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 109,008 KB
最終ジャッジ日時 2023-09-21 19:20:37
合計ジャッジ時間 3,363 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,420 KB
testcase_01 AC 72 ms
71,156 KB
testcase_02 AC 72 ms
71,364 KB
testcase_03 AC 76 ms
71,280 KB
testcase_04 AC 72 ms
71,124 KB
testcase_05 AC 71 ms
71,136 KB
testcase_06 AC 73 ms
71,284 KB
testcase_07 AC 90 ms
85,860 KB
testcase_08 AC 98 ms
90,908 KB
testcase_09 AC 91 ms
85,864 KB
testcase_10 AC 86 ms
82,060 KB
testcase_11 AC 86 ms
82,360 KB
testcase_12 AC 123 ms
109,008 KB
testcase_13 AC 123 ms
108,860 KB
testcase_14 AC 123 ms
108,724 KB
testcase_15 AC 122 ms
108,844 KB
testcase_16 AC 119 ms
108,360 KB
testcase_17 AC 80 ms
76,596 KB
testcase_18 AC 121 ms
108,708 KB
testcase_19 AC 78 ms
76,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int, input().split()))
D=[0]*N
for i in range(N):
  D[A[i]-1]=i+1
d=sum(A)
ans=0
for i in range(N):
  e=d-2*D[-1-i]
  ans=max(ans,e)
  d-=D[-1-i]
print(ans)
0