結果

問題 No.1687 What the Heck?
ユーザー chineristACchineristAC
提出日時 2021-09-24 21:27:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 144 ms / 2,000 ms
コード長 348 bytes
コンパイル時間 419 ms
コンパイル使用メモリ 87,192 KB
実行使用メモリ 110,480 KB
最終ジャッジ日時 2023-09-18 20:39:23
合計ジャッジ時間 3,915 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,912 KB
testcase_01 AC 89 ms
71,936 KB
testcase_02 AC 89 ms
72,144 KB
testcase_03 AC 90 ms
72,212 KB
testcase_04 AC 90 ms
72,312 KB
testcase_05 AC 99 ms
72,440 KB
testcase_06 AC 90 ms
72,020 KB
testcase_07 AC 113 ms
86,040 KB
testcase_08 AC 119 ms
91,880 KB
testcase_09 AC 113 ms
86,220 KB
testcase_10 AC 108 ms
82,488 KB
testcase_11 AC 108 ms
82,804 KB
testcase_12 AC 142 ms
110,476 KB
testcase_13 AC 144 ms
110,440 KB
testcase_14 AC 144 ms
110,136 KB
testcase_15 AC 143 ms
110,480 KB
testcase_16 AC 144 ms
110,284 KB
testcase_17 AC 102 ms
78,452 KB
testcase_18 AC 142 ms
110,440 KB
testcase_19 AC 96 ms
77,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

N = int(input())
P = li()

pos = [-1 for i in range(N)]
for i in range(N):
    pos[P[i]-1] = i+1


res = 0
S = pos[0]
for i in range(1,N):
    tmp = S  - (pos[i])
    res = max(res,tmp)
    S += pos[i]
    

print(res)

0