結果

問題 No.1687 What the Heck?
ユーザー kohei2019kohei2019
提出日時 2023-06-04 21:02:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 257 bytes
コンパイル時間 626 ms
コンパイル使用メモリ 87,172 KB
実行使用メモリ 109,172 KB
最終ジャッジ日時 2023-08-28 08:25:33
合計ジャッジ時間 3,845 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,076 KB
testcase_01 AC 73 ms
71,236 KB
testcase_02 AC 73 ms
71,112 KB
testcase_03 AC 72 ms
71,360 KB
testcase_04 AC 71 ms
71,452 KB
testcase_05 AC 70 ms
71,304 KB
testcase_06 AC 72 ms
71,236 KB
testcase_07 AC 94 ms
85,860 KB
testcase_08 AC 100 ms
91,092 KB
testcase_09 AC 93 ms
86,040 KB
testcase_10 AC 90 ms
82,292 KB
testcase_11 AC 88 ms
82,396 KB
testcase_12 AC 127 ms
108,948 KB
testcase_13 AC 128 ms
109,172 KB
testcase_14 AC 123 ms
109,056 KB
testcase_15 AC 122 ms
109,144 KB
testcase_16 AC 125 ms
108,868 KB
testcase_17 AC 82 ms
76,556 KB
testcase_18 AC 121 ms
109,004 KB
testcase_19 AC 75 ms
76,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
lsP = list(map(int,input().split()))
# どこで負けるか
indls = [0]*(N+1)
for i in range(N):
    indls[lsP[i]] = i+1
ans = 0
summ = 0
for i in range(1,N+1):
    val = summ-indls[i]
    ans = max(ans,val)
    summ += indls[i]
print(ans)
0