結果

問題 No.2325 Skill Tree
ユーザー tailstails
提出日時 2023-05-28 15:11:58
言語 cLay
(20240104-1)
結果
AC  
実行時間 85 ms / 3,000 ms
コード長 451 bytes
コンパイル時間 4,618 ms
コンパイル使用メモリ 181,848 KB
実行使用メモリ 17,316 KB
最終ジャッジ日時 2023-08-27 11:36:56
合計ジャッジ時間 9,880 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,584 KB
testcase_01 AC 2 ms
5,380 KB
testcase_02 AC 2 ms
5,404 KB
testcase_03 AC 2 ms
5,444 KB
testcase_04 AC 2 ms
5,412 KB
testcase_05 AC 2 ms
5,396 KB
testcase_06 AC 2 ms
5,392 KB
testcase_07 AC 9 ms
7,060 KB
testcase_08 AC 11 ms
9,760 KB
testcase_09 AC 12 ms
9,572 KB
testcase_10 AC 16 ms
12,304 KB
testcase_11 AC 14 ms
9,920 KB
testcase_12 AC 25 ms
13,344 KB
testcase_13 AC 25 ms
13,508 KB
testcase_14 AC 27 ms
13,404 KB
testcase_15 AC 28 ms
13,952 KB
testcase_16 AC 26 ms
13,308 KB
testcase_17 AC 25 ms
13,328 KB
testcase_18 AC 25 ms
13,572 KB
testcase_19 AC 25 ms
13,320 KB
testcase_20 AC 24 ms
13,544 KB
testcase_21 AC 24 ms
13,316 KB
testcase_22 AC 27 ms
13,252 KB
testcase_23 AC 28 ms
13,376 KB
testcase_24 AC 26 ms
13,440 KB
testcase_25 AC 25 ms
13,296 KB
testcase_26 AC 26 ms
13,308 KB
testcase_27 AC 82 ms
17,236 KB
testcase_28 AC 77 ms
17,200 KB
testcase_29 AC 74 ms
17,108 KB
testcase_30 AC 78 ms
17,040 KB
testcase_31 AC 79 ms
17,316 KB
testcase_32 AC 56 ms
16,876 KB
testcase_33 AC 67 ms
17,116 KB
testcase_34 AC 70 ms
17,212 KB
testcase_35 AC 70 ms
16,968 KB
testcase_36 AC 68 ms
16,808 KB
testcase_37 AC 85 ms
17,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

int z[2d5+1],l[];
map<int,int>m;
graph g;
void f(int i,int p){
	rep[g.edge[i]](j,g.es[i]){
		if(j!=p){
			z[j]=max(z[i],l[j-2]);
			m[z[j]]+=1;
			f(j,i);
		}
	}
}
{
	int@n,a[n],b[n];
	rd((l,a)(n-1));
	b[0..n-2]=(2..);
	g.setEdge(n+1,n-1,a,b);
	f(1,1);
	int c=1;
	for(auto& i:m){
		i.second=c+=i.second;
	}
	int@q;
	rep(q){
		int@t,@x;
		if(t==1){
			auto i=m.lower_bound(x+1);
			wt(i==m.begin()?1:(--i)->second);
		}else{
			wt(z[x]?:-1);
		}
	}
}

0