結果

問題 No.1687 What the Heck?
ユーザー ayaoniayaoni
提出日時 2021-09-24 22:35:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 130 ms / 2,000 ms
コード長 320 bytes
コンパイル時間 341 ms
コンパイル使用メモリ 87,208 KB
実行使用メモリ 107,764 KB
最終ジャッジ日時 2023-09-18 21:48:44
合計ジャッジ時間 3,283 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,308 KB
testcase_01 AC 72 ms
71,376 KB
testcase_02 AC 73 ms
71,204 KB
testcase_03 AC 78 ms
71,416 KB
testcase_04 AC 73 ms
71,096 KB
testcase_05 AC 74 ms
71,480 KB
testcase_06 AC 75 ms
73,516 KB
testcase_07 AC 97 ms
89,796 KB
testcase_08 AC 105 ms
96,456 KB
testcase_09 AC 97 ms
89,436 KB
testcase_10 AC 92 ms
84,568 KB
testcase_11 AC 92 ms
84,572 KB
testcase_12 AC 130 ms
107,520 KB
testcase_13 AC 129 ms
107,764 KB
testcase_14 AC 128 ms
107,576 KB
testcase_15 AC 128 ms
107,668 KB
testcase_16 AC 129 ms
107,572 KB
testcase_17 AC 82 ms
76,540 KB
testcase_18 AC 128 ms
107,600 KB
testcase_19 AC 78 ms
76,412 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from itertools import accumulate
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

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

pos = [0]*(N+1)
for i in range(N):
    pos[P[i]] = i+1

S_pos = list(accumulate(pos))
ans = 0
for i in range(1,N+1):
    ans = max(ans,S_pos[i-1]-pos[i])

print(ans)
0