結果
| 問題 |
No.3134 二分探索木
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-05-02 21:59:23 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 393 bytes |
| コンパイル時間 | 823 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 65,536 KB |
| 最終ジャッジ日時 | 2025-05-02 21:59:26 |
| 合計ジャッジ時間 | 2,457 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 5 |
| other | RE * 15 |
ソースコード
from sortedcontainers import SortedSet, SortedList, SortedDict n=int(input()) a=list(map(int,input().split())) b=[10**10 for i in range(n)] b[0]=0 c=[0 for _ in range(n)] c[0]=n-1 d=SortedSet([(0,1),(a[0],1),(n+1,0)]) for i in range(1,n): e=d.bisect_right((a[i],0)) x=d[e-1][0] y=d[e][0] c[i]=y-x-2 b[i]=d[e-1][1] d.pop(e-1) d.add((x,b[i]+1)) d.add((a[i],b[i]+1)) print(*b) print(*c)