結果

問題 No.1687 What the Heck?
ユーザー 👑 rin204rin204
提出日時 2022-01-18 02:42:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 216 bytes
コンパイル時間 330 ms
コンパイル使用メモリ 87,292 KB
実行使用メモリ 108,768 KB
最終ジャッジ日時 2023-08-15 07:17:14
合計ジャッジ時間 3,666 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
71,012 KB
testcase_01 AC 66 ms
71,288 KB
testcase_02 AC 66 ms
71,024 KB
testcase_03 AC 70 ms
71,020 KB
testcase_04 AC 67 ms
71,152 KB
testcase_05 AC 66 ms
71,160 KB
testcase_06 AC 65 ms
70,944 KB
testcase_07 AC 86 ms
85,784 KB
testcase_08 AC 96 ms
90,944 KB
testcase_09 AC 91 ms
85,672 KB
testcase_10 AC 82 ms
82,004 KB
testcase_11 AC 80 ms
82,176 KB
testcase_12 AC 116 ms
108,768 KB
testcase_13 AC 118 ms
108,372 KB
testcase_14 AC 115 ms
108,600 KB
testcase_15 AC 121 ms
108,496 KB
testcase_16 AC 125 ms
108,552 KB
testcase_17 AC 74 ms
76,244 KB
testcase_18 AC 117 ms
108,544 KB
testcase_19 AC 72 ms
76,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
P = list(map(int, input().split()))
Q = [0] * n
for i, p in enumerate(P, 1):
    Q[p - 1] = i
    
tot = 0
ans = 0
for i in range(n - 1):
    tot += Q[i]
    ans = max(ans, tot - Q[i + 1])
print(ans)
0