結果

問題 No.1687 What the Heck?
ユーザー neterukunneterukun
提出日時 2021-09-24 21:31:23
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 628 ms / 2,000 ms
コード長 240 bytes
コンパイル時間 375 ms
コンパイル使用メモリ 86,968 KB
実行使用メモリ 107,356 KB
最終ジャッジ日時 2023-09-18 20:46:14
合計ジャッジ時間 7,123 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,420 KB
testcase_01 AC 75 ms
71,424 KB
testcase_02 AC 74 ms
71,324 KB
testcase_03 AC 75 ms
71,200 KB
testcase_04 AC 75 ms
71,448 KB
testcase_05 AC 75 ms
71,392 KB
testcase_06 AC 73 ms
71,204 KB
testcase_07 AC 244 ms
91,296 KB
testcase_08 AC 327 ms
99,216 KB
testcase_09 AC 247 ms
91,448 KB
testcase_10 AC 185 ms
86,304 KB
testcase_11 AC 194 ms
86,584 KB
testcase_12 AC 626 ms
107,244 KB
testcase_13 AC 623 ms
107,356 KB
testcase_14 AC 628 ms
107,260 KB
testcase_15 AC 621 ms
107,272 KB
testcase_16 AC 617 ms
107,084 KB
testcase_17 AC 111 ms
77,620 KB
testcase_18 AC 615 ms
107,268 KB
testcase_19 AC 83 ms
76,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


a = sorted([(val, idx) for idx, val in enumerate(a)])
ans = 0
win = 0
for i in range(n - 1):
    win += a[i][1] + 1
    lose = a[i + 1][1] + 1
    ans = max(win - lose, ans)

print(ans)
0