結果
問題 | No.2325 Skill Tree |
ユーザー |
![]() |
提出日時 | 2023-04-24 18:13:29 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 525 bytes |
コンパイル時間 | 185 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 90,404 KB |
最終ジャッジ日時 | 2024-11-08 18:53:30 |
合計ジャッジ時間 | 80,173 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 25 WA * 11 |
ソースコード
from bisect import bisect_rightn=int(input())lp=[list(map(int,input().split())) for _ in range(n-1)]cil=[[]for _ in range(n)]for i in range(1,n):l,p=lp[i-1]cil[p-1].append((i,l))level=[10**10]*nlevel[0]=0for i in range(n):for node,l in cil[i]:level[node]=max(level[i],l)level_s=sorted(level)for _ in range(int(input())):q,xy=map(int, input().split())if q==1:print(bisect_right(level_s,xy))else:if level[xy-1]==10**10:print(-1)else:print(level[xy-1])