結果

問題 No.1687 What the Heck?
ユーザー chineristACchineristAC
提出日時 2021-09-24 21:27:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 348 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 82,264 KB
実行使用メモリ 108,672 KB
最終ジャッジ日時 2024-07-05 10:02:02
合計ジャッジ時間 2,469 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
54,272 KB
testcase_01 AC 40 ms
54,016 KB
testcase_02 AC 40 ms
53,888 KB
testcase_03 AC 40 ms
54,272 KB
testcase_04 AC 40 ms
53,760 KB
testcase_05 AC 40 ms
53,632 KB
testcase_06 AC 40 ms
54,400 KB
testcase_07 AC 65 ms
77,824 KB
testcase_08 AC 68 ms
84,480 KB
testcase_09 AC 61 ms
77,952 KB
testcase_10 AC 56 ms
72,704 KB
testcase_11 AC 57 ms
72,704 KB
testcase_12 AC 90 ms
107,572 KB
testcase_13 AC 95 ms
108,672 KB
testcase_14 AC 90 ms
107,136 KB
testcase_15 AC 92 ms
107,276 KB
testcase_16 AC 96 ms
108,544 KB
testcase_17 AC 50 ms
65,536 KB
testcase_18 AC 95 ms
108,544 KB
testcase_19 AC 46 ms
62,464 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