結果

問題 No.1687 What the Heck?
ユーザー titiatitia
提出日時 2021-09-24 22:48:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 594 ms / 2,000 ms
コード長 293 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 10,744 KB
実行使用メモリ 49,160 KB
最終ジャッジ日時 2023-09-18 21:54:38
合計ジャッジ時間 5,830 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,816 KB
testcase_01 AC 16 ms
7,860 KB
testcase_02 AC 16 ms
7,852 KB
testcase_03 AC 16 ms
7,880 KB
testcase_04 AC 16 ms
7,748 KB
testcase_05 AC 16 ms
7,932 KB
testcase_06 AC 16 ms
7,884 KB
testcase_07 AC 186 ms
22,452 KB
testcase_08 AC 273 ms
28,512 KB
testcase_09 AC 184 ms
21,996 KB
testcase_10 AC 118 ms
16,940 KB
testcase_11 AC 125 ms
17,676 KB
testcase_12 AC 594 ms
48,420 KB
testcase_13 AC 584 ms
48,468 KB
testcase_14 AC 587 ms
48,572 KB
testcase_15 AC 586 ms
48,612 KB
testcase_16 AC 571 ms
49,160 KB
testcase_17 AC 41 ms
10,544 KB
testcase_18 AC 591 ms
48,632 KB
testcase_19 AC 19 ms
8,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N=int(input())
P=list(map(int,input().split()))

P2=[(P[i],i+1) for i in range(N)]

P2.sort(reverse=True)

SUM=[0]

for x,y in P2[::-1]:
    SUM.append(SUM[-1]+y)

SUM.reverse()

ANS=0

for i in range(1,N):
    ANS=max(ANS,SUM[i]-P2[i-1][1])

print(ANS)
0