首页 > TAG信息列表 > pq1

NC50940 Running Median

题目链接 题目 题目描述 For this problem, you will write a program that reads in a sequence of 32-bit signed integers. After each odd-indexed value is read, output the median (middle value) of the elements received so far. 输入描述 The first line of input cont

[ARC070E]NarrowRectangles【动态规划】【堆】

分析: 首先先考虑300分做法:$dp[i][j]$表示前i个木板,第i个木板的左端点停在j处,转移的话就是$$dp[i][j] = dp[i-1][k] + |l[i]-j|,k \in [j-len_{i-1},j+len_i]$$ 然后把dp[i]看作是关于j的函数,注意到这个函数是下凸包的。 $dp[1] = |l[1]-j|$显然是个下凸壳 然后发现dp[i]的计算操作

986. Interval List Intersections

My PriorityQueue Solution: class Solution { public int[][] intervalIntersection(int[][] firstList, int[][] secondList) { PriorityQueue<int[]> pq1 = new PriorityQueue<>((a,b)->a[0]-b[0]); PriorityQueue<int[]> pq2 =