結果

問題 No.1687 What the Heck?
ユーザー wolgnikwolgnik
提出日時 2021-09-24 21:53:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 250 bytes
コンパイル時間 619 ms
コンパイル使用メモリ 86,484 KB
実行使用メモリ 107,508 KB
最終ジャッジ日時 2023-09-18 21:14:39
合計ジャッジ時間 3,317 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,180 KB
testcase_01 AC 74 ms
71,064 KB
testcase_02 AC 74 ms
71,168 KB
testcase_03 AC 72 ms
71,120 KB
testcase_04 AC 76 ms
71,108 KB
testcase_05 AC 75 ms
71,088 KB
testcase_06 AC 73 ms
71,204 KB
testcase_07 AC 92 ms
85,328 KB
testcase_08 AC 99 ms
90,432 KB
testcase_09 AC 92 ms
85,296 KB
testcase_10 AC 90 ms
81,548 KB
testcase_11 AC 90 ms
81,692 KB
testcase_12 AC 122 ms
107,508 KB
testcase_13 AC 123 ms
107,468 KB
testcase_14 AC 124 ms
107,348 KB
testcase_15 AC 121 ms
107,340 KB
testcase_16 AC 124 ms
107,504 KB
testcase_17 AC 83 ms
76,216 KB
testcase_18 AC 124 ms
107,344 KB
testcase_19 AC 82 ms
76,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
res = 0
table = [0] * (N + 1)
for i in range(N): table[a[i]] = i + 1

sm = 0
for i in range(N):
  sm += table[i]
  res = max(res, sm - table[i + 1])
print(res)
0