結果
問題 |
No.2036 Max Middle
|
ユーザー |
![]() |
提出日時 | 2022-08-12 22:38:47 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 295 bytes |
コンパイル時間 | 179 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 100,728 KB |
最終ジャッジ日時 | 2024-09-23 03:17:20 |
合計ジャッジ時間 | 4,248 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 4 TLE * 1 -- * 12 |
ソースコード
N=int(input()) A=[int(x) for x in input().split()] import heapq q=[] for i in range(N): heapq.heappush(q,(-A[i],i)) ans=0 while q: c,x=heapq.heappop(q) if x==0 or x==N-1: continue if A[x-1]<A[x] and A[x]>A[x+1]: A[x]=min(A[x-1],A[x+1])-1 heapq.heappush(q,(-A[x],x)) ans+=1 print(ans)