結果

問題 No.2325 Skill Tree
ユーザー tyawanmusityawanmusi
提出日時 2023-04-24 18:13:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 525 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 90,532 KB
最終ジャッジ日時 2024-04-26 06:02:40
合計ジャッジ時間 84,729 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,880 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 WA -
testcase_03 AC 30 ms
10,752 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 932 ms
43,648 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 1,437 ms
50,048 KB
testcase_12 AC 2,732 ms
90,112 KB
testcase_13 AC 2,711 ms
90,240 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 2,734 ms
90,112 KB
testcase_17 AC 2,700 ms
90,240 KB
testcase_18 AC 2,680 ms
90,112 KB
testcase_19 AC 2,681 ms
90,112 KB
testcase_20 WA -
testcase_21 AC 2,708 ms
90,240 KB
testcase_22 AC 2,709 ms
90,240 KB
testcase_23 WA -
testcase_24 AC 2,718 ms
90,112 KB
testcase_25 AC 2,696 ms
90,240 KB
testcase_26 AC 2,729 ms
90,112 KB
testcase_27 AC 2,866 ms
90,472 KB
testcase_28 AC 2,853 ms
90,348 KB
testcase_29 AC 2,866 ms
90,148 KB
testcase_30 AC 2,818 ms
90,532 KB
testcase_31 TLE -
testcase_32 AC 2,757 ms
90,352 KB
testcase_33 AC 2,783 ms
90,400 KB
testcase_34 AC 2,763 ms
90,472 KB
testcase_35 AC 2,831 ms
90,340 KB
testcase_36 AC 2,792 ms
90,480 KB
testcase_37 AC 2,851 ms
90,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_right
n=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]*n
level[0]=0
for 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])
0