結果

問題 No.1687 What the Heck?
ユーザー tassei903tassei903
提出日時 2021-09-24 21:40:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 535 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 108,928 KB
最終ジャッジ日時 2023-09-18 20:57:56
合計ジャッジ時間 3,420 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,440 KB
testcase_01 AC 76 ms
71,148 KB
testcase_02 AC 77 ms
71,412 KB
testcase_03 AC 76 ms
71,428 KB
testcase_04 AC 76 ms
71,372 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 92 ms
86,256 KB
testcase_10 AC 89 ms
82,108 KB
testcase_11 AC 89 ms
82,224 KB
testcase_12 AC 124 ms
108,548 KB
testcase_13 AC 127 ms
108,840 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
sys.setrecursionlimit(10**7)
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
n = ni()
p = na()
a = [-1]*n
for i in range(n):
    a[p[i]-1] = i+1
ans = 0
for i in range(n):
    ans = max(ans, (n-i)*(n+1-i)//2-2*a[-1-i])
print(ans)
0