結果
| 問題 |
No.1687 What the Heck?
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-26 08:37:03 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 98 ms / 2,000 ms |
| コード長 | 297 bytes |
| コンパイル時間 | 141 ms |
| コンパイル使用メモリ | 82,660 KB |
| 実行使用メモリ | 114,416 KB |
| 最終ジャッジ日時 | 2024-07-05 15:34:55 |
| 合計ジャッジ時間 | 2,359 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
from itertools import accumulate N=int(input()) P=list(map(int,input().split())) if P==[1,2]: print(0) exit() if P==[2,1]: print(1) exit() idx=[-1]*N for i in range(N): idx[P[i]-1]=i+1 idx_acc=list(accumulate(idx)) ans=0 for i in range(2,N): ans=max(ans,idx_acc[i-1]-idx[i]) print(ans)