結果

問題 No.1687 What the Heck?
ユーザー playerplayer
提出日時 2023-12-27 16:04:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 411 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 110,120 KB
最終ジャッジ日時 2023-12-27 16:04:21
合計ジャッジ時間 2,942 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 37 ms
53,460 KB
testcase_04 AC 36 ms
53,460 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 59 ms
77,864 KB
testcase_10 AC 54 ms
72,144 KB
testcase_11 AC 54 ms
72,256 KB
testcase_12 AC 106 ms
109,936 KB
testcase_13 AC 105 ms
109,936 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
p = list(map(int,input().split()))

# iのカードの勝負で得られる勝ち点
eva = [None for _ in range(n+1)]
for i in range(n):
    eva[p[i]] = i+1

s,t = 0,n*(n+1)//2
ans = -10**100
for i in range(n,0,-1): # どの番号のカードで負けるか
    # 鈴木が出すカードiに負ける場合
    t -= eva[i]
    s += eva[i] 
    ans = max(ans,t-s)
    
print(max(ans,0))   
    
0