結果

問題 No.1687 What the Heck?
ユーザー KudeKude
提出日時 2021-09-24 21:29:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 242 bytes
コンパイル時間 698 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 108,948 KB
最終ジャッジ日時 2023-09-18 20:41:52
合計ジャッジ時間 3,485 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,524 KB
testcase_01 AC 71 ms
71,356 KB
testcase_02 AC 71 ms
71,544 KB
testcase_03 AC 71 ms
71,520 KB
testcase_04 AC 72 ms
71,440 KB
testcase_05 AC 71 ms
71,336 KB
testcase_06 AC 73 ms
71,376 KB
testcase_07 AC 100 ms
85,700 KB
testcase_08 AC 99 ms
90,980 KB
testcase_09 AC 92 ms
85,708 KB
testcase_10 AC 89 ms
82,264 KB
testcase_11 AC 90 ms
82,524 KB
testcase_12 AC 126 ms
108,784 KB
testcase_13 AC 127 ms
108,948 KB
testcase_14 AC 126 ms
108,916 KB
testcase_15 AC 125 ms
108,784 KB
testcase_16 AC 126 ms
108,920 KB
testcase_17 AC 83 ms
76,328 KB
testcase_18 AC 125 ms
108,924 KB
testcase_19 AC 79 ms
76,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
p = list(map(int, input().split()))
ord = [0] * n
for i, x in enumerate(p, 1):
    ord[x - 1] = i

ans = 0
now = 0
for i in range(n - 1):
    now += ord[i] - ord[i + 1]
    ans = max(ans, now)
    now += ord[i + 1]
print(ans)
0