結果

問題 No.1687 What the Heck?
ユーザー raven7959raven7959
提出日時 2021-09-26 08:35:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 231 bytes
コンパイル時間 316 ms
コンパイル使用メモリ 87,184 KB
実行使用メモリ 109,060 KB
最終ジャッジ日時 2023-09-19 02:49:16
合計ジャッジ時間 3,679 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,428 KB
testcase_01 AC 75 ms
71,448 KB
testcase_02 AC 76 ms
71,296 KB
testcase_03 AC 76 ms
71,412 KB
testcase_04 WA -
testcase_05 AC 74 ms
71,452 KB
testcase_06 AC 73 ms
71,240 KB
testcase_07 AC 99 ms
90,172 KB
testcase_08 AC 114 ms
97,308 KB
testcase_09 AC 102 ms
90,012 KB
testcase_10 AC 95 ms
84,920 KB
testcase_11 AC 102 ms
85,192 KB
testcase_12 AC 137 ms
108,976 KB
testcase_13 AC 137 ms
108,988 KB
testcase_14 AC 137 ms
109,060 KB
testcase_15 AC 135 ms
108,900 KB
testcase_16 AC 137 ms
108,816 KB
testcase_17 AC 89 ms
76,564 KB
testcase_18 AC 141 ms
108,912 KB
testcase_19 AC 82 ms
76,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import accumulate
N=int(input())
P=list(map(int,input().split()))
idx=[-1]*N
for i in range(N):
  idx[P[i]-1]=i+1
idx_acc=list(accumulate(idx))
ans=0
for i in range(2,N):
  ans=max(ans,idx_acc[i-1]-idx[i])
print(ans)
0