題解 loj3265 3266 3267 USACO 2020.2 Platinum(全) loj3265 「USACO 2020.2 Platinum」Delegation 題目鏈接 因為是最大化最小值,考慮二分答案。 設當前二分的答案為\(K\)。則要判斷是否有一種划分方式 ...
題意 求所有 n 元逆序對數為 k 的排列所對應的笛卡爾樹中 每次選區間最小連在父親下,再分為左右兩部分遞歸 ,求每個位置在所有樹中的深度和 le n le 思路 是設 f k 表示逆序對數為 k 的 n 排列的數量,那么其生成函數: F x prod i n sum j i x j 大概就是看一下在前面所有數中的位置 然后再來看需要求的東西,深度和即為有多少個父親。 i 為 j 的父親需要滿足 ...
2020-01-26 21:32 0 202 推薦指數:
題解 loj3265 3266 3267 USACO 2020.2 Platinum(全) loj3265 「USACO 2020.2 Platinum」Delegation 題目鏈接 因為是最大化最小值,考慮二分答案。 設當前二分的答案為\(K\)。則要判斷是否有一種划分方式 ...
題面 https://loj.ac/problem/3248 題解 不妨設向下墜落的方向為正方向,那么世界i所處的位置為\(it-A[i](i{\geq}0)\)。那么我們可以畫出各世界的S-t圖像。 先考慮如果\(A[i]>A[Q[i]]\),即i需要追趕的情況。 如果射線i ...
題面 https://loj.ac/problem/3247 題解 考慮CDQ分治。對於\(solve(l,r,v)\)(其中l,r表示當前處理到的區間的左右端點,v是一個vector,存放當前區間內待處理的所有詢問的序號): 設\(m=(l+r)>> ...
LeetCode:Minimum Depth of Binary Tree Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path ...
Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest ...
原題地址:http://oj.leetcode.com/problems/minimum-depth-of-binary-tree/ 題意: Given a binary tree, find its minimum depth. The minimum depth ...
原題地址:https://oj.leetcode.com/problems/maximum-depth-of-binary-tree/ 題意: Given a binary tree, find its maximum depth. The maximum depth ...
題目: Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down ...