結果

問題 No.1687 What the Heck?
ユーザー tcltktcltk
提出日時 2021-09-30 05:14:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 771 ms / 2,000 ms
コード長 593 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 128,952 KB
最終ジャッジ日時 2023-09-24 07:48:25
合計ジャッジ時間 10,548 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 225 ms
89,220 KB
testcase_01 AC 222 ms
89,432 KB
testcase_02 AC 221 ms
89,348 KB
testcase_03 AC 222 ms
89,224 KB
testcase_04 AC 222 ms
89,348 KB
testcase_05 AC 225 ms
89,400 KB
testcase_06 AC 223 ms
89,144 KB
testcase_07 AC 397 ms
104,312 KB
testcase_08 AC 473 ms
108,820 KB
testcase_09 AC 395 ms
104,620 KB
testcase_10 AC 333 ms
100,456 KB
testcase_11 AC 345 ms
100,384 KB
testcase_12 AC 763 ms
128,620 KB
testcase_13 AC 771 ms
128,480 KB
testcase_14 AC 760 ms
128,484 KB
testcase_15 AC 761 ms
128,328 KB
testcase_16 AC 752 ms
128,672 KB
testcase_17 AC 255 ms
93,136 KB
testcase_18 AC 752 ms
128,952 KB
testcase_19 AC 230 ms
92,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
import bisect
import heapq


def input():
    return sys.stdin.readline()[:-1]


# sys.setrecursionlimit(1000000)

# _INPUT = """3
# 3 1 2

# """
# sys.stdin = io.StringIO(_INPUT)

INF = 10**10

def solve(N, P):
    L = [(P[i], i+1) for i in range(N)]
    L.sort()
    s = 0
    ans = 0
    for p, i in L:
        score = s - i
        ans = max(ans, score)
        s += i

    return ans

N = int(input())
P = list(map(int, input().split()))
print(solve(N, P))
0