結果

問題 No.1928 Make a Binary Tree
ユーザー tailstails
提出日時 2022-05-06 22:04:40
言語 cLay
(20240104-1)
結果
WA  
実行時間 -
コード長 387 bytes
コンパイル時間 3,027 ms
コンパイル使用メモリ 178,576 KB
実行使用メモリ 35,004 KB
最終ジャッジ日時 2023-09-20 02:59:05
合計ジャッジ時間 7,514 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 WA -
testcase_12 AC 1 ms
4,376 KB
testcase_13 WA -
testcase_14 AC 1 ms
4,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 3 ms
4,380 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 2 ms
4,380 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 35 ms
13,312 KB
testcase_36 WA -
testcase_37 AC 27 ms
13,164 KB
testcase_38 AC 2 ms
4,376 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 AC 50 ms
35,004 KB
testcase_50 AC 61 ms
13,004 KB
testcase_51 AC 58 ms
13,004 KB
testcase_52 AC 57 ms
13,152 KB
testcase_53 AC 56 ms
13,164 KB
testcase_54 AC 56 ms
12,988 KB
testcase_55 AC 44 ms
27,208 KB
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 AC 60 ms
17,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

graph g;
pair<ll,ll> f(ll i,ll p){
	vector<ll> v;
	rep[g.edge[i]](j,g.es[i]){
		if(j!=p){
			auto r=f(j,i);
			v.push_back(r.first);
			v.push_back(r.second);
		}
	}
	sort(v.begin(),v.end());
	v.push_back(0);
	if(v.size()<3){
		return {-1,v[0]};
	}else{
		return {v[0]+v[1]-1,v[2]};
	}
}
{
	ll@n;
	int a[n],b[];
	rd((a,b)(n-1));
	g.setEdge(n+1,n-1,a,b);
	auto r=f(1,1);
	wt(-r.first);
}
0