結果
| 問題 | No.1687 What the Heck? |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-30 05:14:35 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 504 ms / 2,000 ms |
| + 871µs | |
| コード長 | 593 bytes |
| 記録 | |
| コンパイル時間 | 272 ms |
| コンパイル使用メモリ | 96,620 KB |
| 実行使用メモリ | 130,916 KB |
| 最終ジャッジ日時 | 2026-08-15 08:35:07 |
| 合計ジャッジ時間 | 7,786 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
#!/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))