結果

問題 No.2325 Skill Tree
ユーザー tyawanmusityawanmusi
提出日時 2023-04-24 18:17:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,955 ms / 3,000 ms
コード長 562 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 92,076 KB
最終ジャッジ日時 2024-04-26 06:05:13
合計ジャッジ時間 77,571 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 29 ms
10,880 KB
testcase_02 AC 29 ms
10,752 KB
testcase_03 AC 31 ms
10,880 KB
testcase_04 AC 30 ms
10,880 KB
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 30 ms
10,880 KB
testcase_07 AC 987 ms
21,632 KB
testcase_08 AC 827 ms
43,648 KB
testcase_09 AC 1,176 ms
33,408 KB
testcase_10 AC 1,121 ms
66,048 KB
testcase_11 AC 1,292 ms
49,792 KB
testcase_12 AC 2,391 ms
90,240 KB
testcase_13 AC 2,435 ms
90,112 KB
testcase_14 AC 2,394 ms
90,240 KB
testcase_15 AC 2,464 ms
90,112 KB
testcase_16 AC 2,418 ms
90,112 KB
testcase_17 AC 2,400 ms
90,240 KB
testcase_18 AC 2,384 ms
90,240 KB
testcase_19 AC 2,355 ms
90,112 KB
testcase_20 AC 2,374 ms
90,112 KB
testcase_21 AC 2,375 ms
90,112 KB
testcase_22 AC 2,421 ms
90,240 KB
testcase_23 AC 2,415 ms
90,112 KB
testcase_24 AC 2,417 ms
90,240 KB
testcase_25 AC 2,448 ms
90,112 KB
testcase_26 AC 2,457 ms
90,240 KB
testcase_27 AC 2,822 ms
91,900 KB
testcase_28 AC 2,814 ms
91,900 KB
testcase_29 AC 2,844 ms
91,692 KB
testcase_30 AC 2,825 ms
92,076 KB
testcase_31 AC 2,825 ms
92,028 KB
testcase_32 AC 2,806 ms
92,040 KB
testcase_33 AC 2,759 ms
91,932 KB
testcase_34 AC 2,955 ms
92,028 KB
testcase_35 AC 2,806 ms
91,908 KB
testcase_36 AC 2,803 ms
91,916 KB
testcase_37 AC 2,817 ms
91,900 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
sta=[0]
for node in sta:
    for mode,l in cil[node]:
        level[mode]=max(level[node],l)
        sta.append(mode)
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