結果

問題 No.1687 What the Heck?
ユーザー puznekopuzneko
提出日時 2021-11-23 22:38:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 532 ms / 2,000 ms
コード長 266 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 10,684 KB
実行使用メモリ 43,376 KB
最終ジャッジ日時 2023-09-08 03:11:44
合計ジャッジ時間 6,433 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,796 KB
testcase_01 AC 15 ms
7,892 KB
testcase_02 AC 15 ms
7,960 KB
testcase_03 AC 15 ms
7,836 KB
testcase_04 AC 15 ms
7,808 KB
testcase_05 AC 15 ms
7,824 KB
testcase_06 AC 15 ms
7,856 KB
testcase_07 AC 170 ms
20,596 KB
testcase_08 AC 249 ms
25,880 KB
testcase_09 AC 168 ms
20,544 KB
testcase_10 AC 110 ms
16,084 KB
testcase_11 AC 114 ms
16,752 KB
testcase_12 AC 532 ms
43,212 KB
testcase_13 AC 525 ms
43,188 KB
testcase_14 AC 513 ms
43,376 KB
testcase_15 AC 528 ms
43,152 KB
testcase_16 AC 514 ms
42,716 KB
testcase_17 AC 39 ms
10,804 KB
testcase_18 AC 529 ms
43,284 KB
testcase_19 AC 18 ms
8,196 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin

n, *a = map(int, stdin.read().split())
asort = []
for i in range(n):
    asort.append((-a[i],i+1))
asort.sort()

ans = 0
val = n * (n+1) // 2
for i in range(n):
    val -= asort[i][1]
    ans = max(ans,val-asort[i][1])
print("{}".format(ans))
0