鏈接:https://ac.nowcoder.com/acm/contest/11255/E 來源:牛客網 題目描述 Bob has a tree with nn nodes and the weight of i-th node is wiwi. But Bob forgot ...
題意:給定N,M,然后給出M組信息 u,v,l,r ,表示u到v有 l,r 范圍的通行證有效。問有多少種通行證可以使得 和N連通。 思路:和bzoj魔法森林有點像,LCT維護最小生成樹。 開始和隊友在想維護連通性,而不是維護樹,這樣好像會很麻煩。 隊友yy了一個算法:用線段樹模擬並查集維護連通性。 發現和標程有點像 我的代碼:LCT維護最小生成樹。 ...先給代碼,后面補一下題解。 LCT代碼: ...
2019-08-10 16:41 1 510 推薦指數:
鏈接:https://ac.nowcoder.com/acm/contest/11255/E 來源:牛客網 題目描述 Bob has a tree with nn nodes and the weight of i-th node is wiwi. But Bob forgot ...
目錄 Contest Info Solutions A.Equivalent Prefixes B.Integration C.Euclidean Distance D.Parity of Tuples E ...
2019牛客暑期多校訓練營(第一場) A.Equivalent Prefixes solved by RDC 42min -1, assisted by F0_0H 題意 給兩個序列,求最長前綴使得笛卡爾樹相同。 做法1 二分前綴,建笛卡爾樹。 做法2 遞歸地計算 \([l,r ...
鏈接:https://ac.nowcoder.com/acm/contest/882/F來源:牛客網 Given 2N people, you need to assign each of them into either red team or white team ...
參考於: https://www.luogu.org/problemnew/solution/P4723 shadowice1984 (太難) https://www.cnblogs.com/zhgy ...
A. Eddy Walker solved by rdc 202min -1 題意 一個點在長度為 \(n\) 的環上游走,輸出第一次訪問到所有點時在 \(x\) 上的概率。 做法 考慮經典的線段上隨游走問題,數軸上有 \(x=0\) 的 \(A\) 點,與 \(x=n\) 的 \(B ...
題目傳送門 題號 A B C D E F G H I J 狀態 ...
題目傳送門 題號 A B C D E F G H I J 狀態 ...