题目链接:https://www.luogu.org/problem/P1502 扫描线的板子题,把每个点看成矩形,存下边(x,y,y+h-1,li)和(x+w-1,y,y+h-1),在按横坐标扫线段更新y区间,线段树维护区间最大值 #include<iostream> #include<algorithm> using namespace std; #define ll long long #define ls l,mid,rt<<1 #define rs mid+1…
将每个点拓展为矩形,将\(y\)离散,延\(x\)轴扫描,每次更新最值 用了一百年的pushdown操作疑似有问题,亦或这道题特殊,我乱改了pushdown位置就过了,我能怎么办,WA了一发,y数组没开够又RE了一发... 话说POJ上的情书让我回忆起童年那个彪悍的女孩,一晃十年了 Fleeting time does not blur my memory of you. Can it really be 4 years since I first saw you? I still rememb…
Applet程序. 可以把更复杂的几何形状定义为GeneralPath类型的对象.GeneralPath可以是直线.Quad2D曲线和Cubic2D曲线的结合体,甚至可以包含其他GeneralPath对象. 1.绘制星星: import java.awt.geom.*; public class Star { // Return a path for a star at x,y public static GeneralPath starAt(float x, float y) { Point2…
Sliding Window Time Limit: 12000MS Memory Limit: 65536K Total Submissions: 66613 Accepted: 18914 Case Time Limit: 5000MS Description An array of size n ≤ 106 is given to you. There is a sliding window of size k which is moving from the very left…
题目链接:https://www.luogu.org/problem/P1886#submit 题意:给定n个数,求大小为k的滑动窗口中最小值和最大值. 思路:单调队列模板题. AC代码: #include<cstdio> #include<algorithm> using namespace std; ; int n,k,head,tail; int a[maxn],q[maxn],p[maxn]; int main(){ scanf("%d%d",&…