結果

問題 No.898 tri-βutree
ユーザー tailstails
提出日時 2022-10-21 14:47:14
言語 cLay
(20240104-1)
結果
AC  
実行時間 62 ms / 4,000 ms
コード長 223 bytes
コンパイル時間 4,225 ms
コンパイル使用メモリ 177,612 KB
実行使用メモリ 16,776 KB
最終ジャッジ日時 2023-09-13 15:57:15
合計ジャッジ時間 9,359 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
14,220 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 62 ms
16,556 KB
testcase_08 AC 61 ms
16,704 KB
testcase_09 AC 62 ms
16,520 KB
testcase_10 AC 61 ms
16,776 KB
testcase_11 AC 62 ms
16,588 KB
testcase_12 AC 61 ms
16,508 KB
testcase_13 AC 61 ms
16,728 KB
testcase_14 AC 62 ms
16,520 KB
testcase_15 AC 62 ms
16,596 KB
testcase_16 AC 61 ms
16,520 KB
testcase_17 AC 60 ms
16,572 KB
testcase_18 AC 61 ms
16,584 KB
testcase_19 AC 62 ms
16,512 KB
testcase_20 AC 61 ms
16,512 KB
testcase_21 AC 62 ms
16,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ll@n;
int u[n],v[],w[];
rd((u,v,w)(n-1));
wgraph<int>g;
g.setEdge(n,n-1,u,v,w);
ll d[n];
g.getDistForest(0,d);
HLD h;
h.init(g.g);
ll@q;
rep(q){
	ll@x,@y,@z;
	wt(d[x]+d[y]+d[z]-d[h.lca(x,y)]-d[h.lca(x,z)]-d[h.lca(y,z)]);
}
0