首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏程序编程之旅

    HDOJ 2056 Rectangles

    Problem Description Given two rectangles and the coordinates of two points on the diagonals of each rectangle,you have to calculate the area of the intersected part of two rectangles. its sides are parallel

    33510发布于 2021-01-20
  • 来自专栏数据结构与算法

    Rectangles(前缀和)

    呵呵哒,昨天cf半夜场,一道全场切的题,我没做出来。。不想找什么理由,不会做就是不会做。。

    38130发布于 2018-09-17
  • 来自专栏机器学习入门

    Number Of Corner Rectangles

    Number Of Corner Rectangles 传送门:750. Number Of Corner Rectangles Problem: Given a grid where each entry is only 0 or 1, find the number of corner rectangles. , four 2x3 and 3x2 rectangles, and one 3x3 rectangle. Example 3: Input: grid = [[1, 1, 1, 1]] Output: 0 Explanation: Rectangles must have four

    81670发布于 2018-01-02
  • 来自专栏Zaqdt_ACM

    Codeforces Round #497 (Div. 2) B.Turn the Rectangles(水题)

    题目链接:http://codeforces.com/contest/1008/problem/B

    35320发布于 2019-01-11
  • 来自专栏福大大架构师每日一题

    给你一个数组 rectangles ,其中

    给你一个数组 rectangles ,其中 rectanglesi = xi, yi, ai, bi 表示一个坐标轴平行的矩形。

    44410编辑于 2022-01-21
  • 来自专栏glm的全栈学习之路

    Rectangles

    Rectangles time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given nn rectangles on a plane with coordinates of their bottom left and upper Some (n−1)(n−1) of the given nn rectangles have some common point. Find any point with integer coordinates that belongs to at least (n−1)(n−1) given rectangles. The picture below shows the rectangles in the third and fourth samples. ?

    42230发布于 2020-09-28
  • 来自专栏江涛的博客

    leetcode - 可以形成最大正方形的矩形数目

    题意 给你一个数组 rectangles ,其中 rectangles[i] = [li, wi] 表示第 i 个矩形的长度为 li、宽度为 wi。 设 maxLen 为可以从矩形数组 rectangles 切分得到的 最大正方形 的边长。 返回可以切出边长为 maxLen 的正方形的矩形 数目 。 示例 示例 1: 输入:rectangles = [[5,8],[3,9],[5,12],[16,5]] 输出:3 解释:能从每个矩形中切出的最大正方形边长分别是 [5,3,5,5] 。 示例 2: 输入:rectangles = [[2,3],[3,7],[4,3],[3,7]] 输出:3 提示 1 <= rectangles.length <= 1000 rectangles[i] (rectangles) { const obj = {}; rectangles.forEach((item) => { const res = item[0] > item[1]

    61110发布于 2021-01-28
  • 来自专栏算法之名

    MTCNN详情介绍

    ): """将矩形框修整为正方形 """ rectangles = np.array(rectangles) w = rectangles [:, 2] - rectangles[:, 0] h = rectangles[:, 3] - rectangles[:, 1] l = np.maximum(w, h # 左上角的坐标值为0 if rectangles[j][0] >= rectangles[j][2]: rectangles [j][0] = 0 elif rectangles[j][1] > rectangles[j][3]: rectangles[j][1] = 0 if len(rectangles) == 0: return rectangles boxes = np.array(rectangles)

    2.2K30编辑于 2022-05-06
  • 来自专栏福大大架构师每日一题

    2025-07-06:判断网格图能否被切割成块。用go语言,给定一个大小为 n x n 的网格,坐标系的原点设在左下角。你有一个

    你有一个二维数组 rectangles,其中每个元素 rectangles[i] = [startx, starty, endx, endy] 表示一个矩形,其左下角坐标为 (startx, starty 3 <= rectangles.length <= 100000。 0 <= rectangles[i][0] < rectangles[i][2] <= n。 0 <= rectangles[i][1] < rectangles[i][3] <= n。 矩形之间两两不会有重叠。 输入:n = 5, rectangles = [[1,0,5,2],[0,2,2,4],[3,2,5,3],[0,4,4,5]]。 输出:true。 [][]int)bool { a := make([]pair, len(rectangles)) b := make([]pair, len(rectangles)) for

    16300编辑于 2025-07-08
  • 来自专栏福大大架构师每日一题

    文心一言 VS 讯飞星火 VS chatgpt (199)-- 算法导论14.3 7题

    ) == 0 { return nil } node := &SegmentTreeNode{Rectangles: rectangles} if len(rectangles node.Rectangles = mergeRectangles(left.Rectangles, right.Rectangles) return node } func panic when i=len(node.Rectangles)-1 0<=i<len(node.Rectangles)-1 will solve this problem! (i, j int) bool { return rectangles[i].p1.y < rectangles[j].p1.y || (rectangles[i ].p1.y == rectangles[j].p1.y && rectangles[i].p1.x < rectangles[j].p1.x) }) var stack []Segment

    35320编辑于 2024-02-17
  • 来自专栏Linux驱动

    LeetCode-391. 完美矩形(使用C语言编译,详解)

    思路 首先,rectangles[][]数组里保存的每个小矩形,都有4个角. 以示例4的rectangles[0]矩形的左下角为例:   因为rectangles[0]等于{1,1,3,3},所以左下角为(1,1),处于的位置为{0,1}  所以,下面程序便通过一个 method [j]>rectangles[i][j]) Rectangles[j]=rectangles[i][j]; } else if(Rectangles[j]<rectangles[i][j]) //计算 right,top Rectangles[j]=rectangles[i][j]; tmp[0]=rectangles[i][method[j][0]]; tmp[1]=rectangles

    1.3K60发布于 2018-04-17
  • 来自专栏ml

    hdu---1506(Largest Rectangle in a Histogram/dp最大子矩阵)

    The rectangles have equal widths but may have different heights. For example, the figure on the left shows the histogram that consists of rectangles with the heights 2, 1, 4, 5, 1, 3, 3, measured in units where 1 is the width of the rectangles: ? Note that the order of the rectangles, i.e., their heights, is important. These numbers denote the heights of the rectangles of the histogram in left-to-right order.

    71150发布于 2018-03-26
  • 来自专栏福大大架构师每日一题

    2022-10-09:我们给出了一个(轴对齐的)二维矩形列表 rectangles 。 对于 rectangle = ,其

    2022-10-09:我们给出了一个(轴对齐的)二维矩形列表 rectangles 。 计算平面中所有 rectangles 所覆盖的 总面积 。任何被两个或多个矩形覆盖的区域应只计算 一次 。返回 总面积 。因为答案可能太大,返回 10^9 + 7 的 模 。 输入:rectangles = [0,0,2,2,1,0,2,3,1,0,3,1]。输出:6。答案2022-10-09:线段树模板题。一个矩形两个事件。 [i as usize][0]; let y1 = rectangles[i as usize][1] + 1; let x2 = rectangles[i [1, 0, 3, 1]]; let ans = Solution::rectangle_area(rectangles); println!("ans = {:?}"

    47810编辑于 2022-10-09
  • 来自专栏Michael阿明学习之路

    LeetCode 2001. 可互换矩形的组数

    题目 用一个下标从 0 开始的二维整数数组 rectangles 来表示 n 个矩形,其中 rectangles[i] = [widthi, heighti] 表示第 i 个矩形的宽度和高度。 计算并返回 rectangles 中有多少对 可互换 矩形。 示例 1: 输入:rectangles = [[4,8],[3,6],[10,20],[15,30]] 输出:6 解释:下面按下标(从 0 开始)列出可互换矩形的配对情况: - 矩形 0 和矩形 1 : 提示: n == rectangles.length 1 <= n <= 10^5 rectangles[i].length == 2 1 <= widthi, heighti <= 10^5 来源: 解题 按照 w/h 进行计数,组内可以取出 种组合 class Solution: def interchangeableRectangles(self, rectangles: List[

    44720编辑于 2022-01-07
  • 来自专栏北京马哥教育

    教程 | 比Python快100倍,利用spaCy和Cython实现高速NLP项目

    random()) for i in range(n_rectangles)) n_out = check_rectangles(rectangles, threshold=0.25) print (n_out) check_rectangles 函数是瓶颈部分! size information => we need to give it explicitly for rectangle in rectangles[:n_rectangles]: if rectangles n_rectangles, sizeof(Rectangle)) for i in range(n_rectangles): rectangles[i].w = random() rectangles [i].h = random() n_out = check_rectangles(rectangles, n_rectangles, threshold) print(n_out) 我们在这里使用了原生

    2K00发布于 2018-07-31
  • 来自专栏linux、Python学习

    利用spaCy和Cython实现高速NLP项目

    random()) for i in range(n_rectangles)) n_out = check_rectangles(rectangles, threshold=0.25) print( n_out) check_rectangles 函数是瓶颈部分! size information => we need to give it explicitly for rectangle in rectangles[:n_rectangles]: if rectangles , sizeof(Rectangle)) for i in range(n_rectangles): rectangles[i].w = random() rectangles[i].h = random () n_out = check_rectangles(rectangles, n_rectangles, threshold) print(n_out) 我们在这里使用了原生 C 指针数组,但你也可以选择其他选项

    2.1K20发布于 2019-06-19
  • 来自专栏freesan44

    LeetCode 5868. 可互换矩形的组数

    题目 用一个下标从 0 开始的二维整数数组 rectangles 来表示 n 个矩形,其中 rectanglesi = widthi, heighti 表示第 i 个矩形的宽度和高度。 计算并返回 rectangles 中有多少对 可互换 矩形。 示例 1: 输入:rectangles = [[4,8],[3,6],[10,20],[15,30]] 输出:6 解释:下面按下标(从 0 开始)列出可互换矩形的配对情况: - 矩形 0 和矩形 1 提示: n == rectangles.length 1 <= n <= 105 rectanglesi.length == 2 1 <= widthi, heighti <= 105 解题思路 class Solution: def interchangeableRectangles(self, rectangles: List[List[int]]) -> int: from

    32800发布于 2021-09-12
  • 来自专栏Michael阿明学习之路

    LeetCode 1725. 可以形成最大正方形的矩形数目

    题目 给你一个数组 rectangles ,其中 rectangles[i] = [li, wi] 表示第 i 个矩形的长度为 li 、宽度为 wi 。 设 maxLen 为可以从矩形数组 rectangles 切分得到的 最大正方形 的边长。 返回可以切出边长为 maxLen 的正方形的矩形 数目 。 示例 1: 输入:rectangles = [[5,8],[3,9],[5,12],[16,5]] 输出:3 解释:能从每个矩形中切出的最大正方形边长分别是 [5,3,5,5] 。 示例 2: 输入:rectangles = [[2,3],[3,7],[4,3],[3,7]] 输出:3 提示: 1 <= rectangles.length <= 1000 rectangles[ 解题 计数 class Solution { public: int countGoodRectangles(vector<vector<int>>& rectangles) {

    57620发布于 2021-02-19
  • 来自专栏labuladong的算法专栏

    这道「完美矩形」给我整不会了…

    来看看力扣第 391 题「完美矩形」,题目会给我们输入一个数组rectangles,里面装着若干四元组(x1,y1,x2,y2),每个四元组就是记录一个矩形的左下角和右上角顶点坐标。 也就是说,输入的rectangles数组实际上就是很多小矩形,题目要求我们输出一个布尔值,判断这些小矩形能否构成一个「完美矩形」。 函数签名如下: def isRectangleCover(rectangles: List[List[int]]) -> bool 所谓「完美矩形」,就是说rectangles中的小矩形拼成图形必须是一个大矩形 rectangles数组中每个元素都是一个四元组(x1, y1, x2, y2),表示一个小矩形的左下角顶点坐标和右上角顶点坐标。 这个很简单吧,左下角顶点(X1, Y1)就是rectangles中所有小矩形中最靠左下角的那个小矩形的左下角顶点;右上角顶点(X2, Y2)就是所有小矩形中最靠右上角的那个小矩形的右上角顶点。

    93220发布于 2021-09-23
  • 来自专栏chenjx85的技术专栏

    leetcode-836-Rectangle Overlap

    Two rectangles overlap if the area of their intersection is positive.  To be clear, two rectangles that only touch at the corner or edges do not overlap. Given two rectangles, return whether they overlap. 1,1,3,3] Output: true Example 2: Input: rec1 = [0,0,1,1], rec2 = [1,0,2,1] Output: false Notes: Both rectangles All coordinates in rectangles will be between -10^9 and 10^9.

    45230发布于 2019-03-14
领券