• 2024-08-13给定普通有色图像找到特定区域
    `importosimporttimeimportcv2importnumpyasnpimportmathimportdatetimedeffilter_rectangles(rect_list,min_area_threshold,width_to_height_ratio_thresh=3):filtered_rectangles=[]forrectinrect_list:width=rect['width']height
  • 2024-08-07Gym102788,B - Rectangles题解
    水水水~题目链接戳我分析首先根据题目条件可得式子=>\((x-2)(y-2)=n(2x+2y-4)\)化简式子可得\[\begin{align}(x-2)(y-2)=&n(2x+2y-4)\\xy-2x-2y+4=&2nx+2ny-4n\\x(y-2n-2)=&2ny-4n-4+2y\\x=&\frac{2ny-4n-4
  • 2024-07-24Avalonia-实现控件出现时上升效果(简单)
    Avalonia实践-实现控件出现时上升效果最近在学习Avalonia,看到WinUI里有个经典的出现时上升样式,拿来练练手同时学习Style和Animation目标效果是下面这样Demo使用版本:Avalonia(11.0.10)CommunityToolkit.Mvvm(8.2.1)简单用CommunityToolKit.MVVM写了一下代码MainW
  • 2024-05-04扫描线
    题目链接https://leetcode.cn/problems/rectangle-area-ii/题目大意题目思路选取连续的x值:(left,right),在这个区间内,沿着x轴的方向扫描,求出所有符合条件的(y1,y2)算出扫描区间的h,结合w*h,算出面积!礼貌拿图,多谢三叶姐(https://leetcode.cn/problems/rectangle-area-ii/so
  • 2024-04-04[ABC223E] Placing Rectangles 题解
    [ABC223E]PlacingRectangles题解思路解析根据题目可知,其实三个长方形无非只有以下两种摆放方式。若大长方形长为\(y\),宽为\(x\),则我们对于第一种情况就固定住宽,判断能否使长度小于等于长;对于第二种情况同样固定住宽,此时A长方形右边空间的长就确定了,就只需要判断B,C
  • 2024-03-14HDU 2056:Rectangles(两个矩形交点的性质)
    一、原题链接Problem-2056(hdu.edu.cn)二、题面Giventworectanglesandthecoordinatesoftwopointsonthediagonalsofeachrectangle,youhavetocalculatetheareaoftheintersectedpartoftworectangles.itssidesareparalleltoOXandOY.三、
  • 2024-02-27题解 CF983D Arkady and Rectangles
    \(\texttt{link}\)题意平面直角坐标系上给定\(n\)个矩形,第\(i\)个矩形颜色为\(i\),颜色大的矩形将覆盖颜色小的矩形,问最后能看到几种颜色。\(1\len\le10^5,|x_i|,|y_i|\le10^9\)题解首先离散化,考虑扫描线如何维护序列上的颜色。一个区间\([l,r]\)投射到线段树上\(
  • 2023-11-25EC-Final 2022 Rectangles
    有点营养的题。很容易做三条竖线,接下来考虑两竖一横。直接枚举横线会变成支持加入区间删除区间维护有多少种方案选择两个点使得任何区间至少包含其一。当然一个想法是线段树分治,以一只log的代价转化为只有加入,这个先放着。胡乱离散化一下,又可以转化为点带权但值域只有\(2n\)。
  • 2023-11-01poj 2411 状压dp入门题
    Mondriaan'sDreamTimeLimit:3000MS MemoryLimit:65536KTotalSubmissions:29096 Accepted:15505DescriptionSquaresandrectanglesfascinatedthefamousDutchpainterPietMondriaan.Onenight,afterproducingthedrawingsinhis�
  • 2023-10-13洛谷 P8192 - [USACO22FEB] Paint by Rectangles P
    比较抽象的一个题。首先先考虑\(T=1\),如果我们建一张图,将图上所有横线与竖线的交点看作图上的点,相邻的有线段相连的点看作图上的边的话,那么显然会得到一张平面图,而我们要计算的是平面图上面的个数,根据公式\(F=E-V+C+1\),其中\(C\)为这张图中连通块的个数。设\(c\)为线段与线
  • 2023-05-30leetcode 836. Rectangle Overlap
    Arectangleis representedasa list[x1,y1,x2,y2],where (x1,y1) arethecoordinatesofitsbottom-leftcorner,and(x2, y2) arethecoordinatesofitstop-rightcorner.Tworectanglesoverlapiftheareaoftheirintersectionispositive. Tobecl
  • 2023-05-28comp2123 问题解答
    comp2123Assignment5s12023Problem1.Wewanttodesignadivideandconqueralgorithmforcomputingtheunionofacollectionofrectangles.Theinputrectanglesarealignedwiththeaxesandtheyareallstabbedbythey-axis.Eachrectangleisrepresen
  • 2023-02-18[CF983D]Arkady and Rectangles
    \(\text{Solution}\)二维平面很容易想到扫描线,然后不知道维护什么信息颜色的变化自然要能记录下来,所以线段树每个结点维护一个set表示覆盖这个点代表区间的所有颜色这
  • 2023-02-13【题解】CF364E Empty Rectangles
    题目分析:如果题目放在序列上,也就是询问一个长度为\(n\)的序列有多少个子段满足其和为\(k\),那么考虑应该怎么做。显然就是使用分治,即左边的答案+右边的答案+跨过中间的
  • 2022-12-14CF364E Empty Rectangles
    链接:https://www.luogu.com.cn/problem/CF364E题目描述:你有一个\(n*m\)的\(01\)矩阵,现在询问在这其中有多少个子矩阵满足包含\(k\)个\(1\),即和为\(k\)。题解:考虑枚举一个
  • 2022-11-29CF 1722E Counting Rectangles(前缀和)
    题目分析(摘自这篇博客,原博主关于包含的定义有错误,在此处做了修改)给出一个长度为1e5的矩阵序列和1e5次询问,每次询问给出两个上下界矩阵,保证大矩阵包含小矩阵,请输出矩阵序
  • 2022-11-20Hitachi2020E Odd Sum Rectangles
    Hitachi2020E看到\(\oplus\)操作和\(2^n-1\)时猜结论\(ans_{i,j}=\operatorname{popcount}(i\&j)\bmod2\),过不去,然后就不会了。然而令答案的二维前缀和为\(\opera
  • 2022-11-16Counting Rectangles(二维数组前缀和)
    题目链接题目描述:Youhave\(n\)rectangles,the\(i\)-threctanglehasheight\(h_i\)andwidth\(w_i\).Youareasked\(q\)queriesoftheform\(h_sw_sh_b
  • 2022-11-09HDU 1828 Picture
    ProblemDescriptionAnumberofrectangularposters,photographsandotherpicturesofthesameshapearepastedonawall.Theirsidesareallvertical
  • 2022-10-26单调栈--Largest Rectangle in a Histogram
    DescriptionAhistogramisapolygoncomposedofasequenceofrectanglesalignedatacommonbaseline.Therectangleshaveequalwidthsbutmayhavedifferent
  • 2022-10-23[ARC081F] Flip and Rectangles
    考虑转换题目给出的条件。可以观察到一些性质若某个矩形能被操作为全\(1\),那么其任意子矩形也一定可以。任意行列交换不影响矩阵是否能变为全\(1\)然后重要的来了
  • 2022-10-13【luogu CF1396D】Rainbow Rectangles(线段树)
    RainbowRectangles题目链接:luoguCF1396D题目大意给你一个L*L的矩形,里面有n个点,有各自的颜色。然后问你有多少个端点是整点的矩形可以圈出所有颜色至少有一个点。
  • 2022-09-03NC51189 Mondriaan's Dream
    题目链接题目题目描述SquaresandrectanglesfascinatedthefamousDutchpainterPietMondriaan.Onenight,afterproducingthedrawingsinhis'toiletseries