結果

問題 No.1687 What the Heck?
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-09-24 21:35:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 270 bytes
コンパイル時間 1,259 ms
コンパイル使用メモリ 87,092 KB
実行使用メモリ 108,608 KB
最終ジャッジ日時 2023-09-18 20:51:55
合計ジャッジ時間 3,547 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,376 KB
testcase_01 AC 74 ms
71,240 KB
testcase_02 AC 73 ms
71,476 KB
testcase_03 AC 73 ms
71,464 KB
testcase_04 AC 74 ms
71,400 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 93 ms
85,684 KB
testcase_10 AC 89 ms
82,124 KB
testcase_11 AC 90 ms
82,336 KB
testcase_12 AC 124 ms
108,448 KB
testcase_13 AC 126 ms
108,528 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
n = int(input())
P = list(map(int,input().split()))
ans = 0
use = [0]*(n+1)
score = 0
for i in range(n)[::-1]:
    p = P[i]
    if p == n:
        score -= i+1
        use[1] = 1
    else:
        score += i+1
        use[p+1] = 1
print(max(ans,score))
0