Rectangles】的更多相关文章

题目地址: http://poj.org/problem?id=1314 题意: 给出一串的点,有些点可以构成正方形,请按照字符排序输出. 因为这道题的用处很大, 最近接触的cv 中的Rectangle Detection 中就有方法使用到了这个算法. 但实际中使用的算法还是暴力. 不过因为数据点较少,可以直接快排之后,再来个迭代,就得到答案了 #include <cstdio> #include <iostream> #include <cstring> #inclu…
Description We are given a figure consisting of only horizontal and vertical line segments. Our goal is to count the number of all different rectangles formed by these segments. As an example, the number of rectangles in the Figures 1 and 2 are 5 and…
题目链接: B. Searching Rectangles time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Filya just learned new geometry object — rectangle. He is given a field consisting of n × n unit cells. Rows ar…
White Rectangles Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 732    Accepted Submission(s): 368 Problem DescriptionYou are given a chessboard made up of N squares by N squares with equal siz…
控制台程序. import javax.swing.JComponent; import java.util.*; import java.awt.*; import java.awt.geom.*; @SuppressWarnings("serial") public class SketcherView extends JComponent implements Observer { public SketcherView(Sketcher theApp) { this.theAp…
Counting Rectangles Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 1043 Accepted: 546 Description We are given a figure consisting of only horizontal and vertical line segments. Our goal is to count the number of all different rectangles…
Given n points on the XY plane, count how many regular rectangles are formed. A rectangle is regular if and only if its sides are all parallel to the axis.InputThe first line contains the number of tests t (1 ≤ t ≤ 10). Each case contains a single lin…
Counting rectangles By counting carefully it can be seen that a rectangular grid measuring 3 by 2 contains eighteen rectangles: Although there exists no rectangular grid that contains exactly two million rectangles, find the area of the grid with the…
Rectangles Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 19110    Accepted Submission(s): 6187 Problem Description Given two rectangles and the coordinates of two points on the diagonals of ea…
Project Euler 85: Investigating the number of rectangles in a rectangular grid Number of Rectangles in a Grid Given a grid of size m x n, calculate the total number of rectangles contained in this rectangle. All integer sizes and positions are counte…
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 to OX and OY . Input Input The first line o…
White Rectangles Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 964    Accepted Submission(s): 485 Problem Description You are given a chessboard made up of N squares by N squares with equal s…
Rectangles Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 19299    Accepted Submission(s): 6255 Problem Description Given two rectangles and the coordinates of two points on the diagonals of e…
Description Problem H Counting Rectangles Input: Standard Input Output:Standard Output Time Limit: 3Seconds   Given n points on the XY plane, count how many regular rectanglesare formed. A rectangle is regular if and only if its sides are all paralle…
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 to OX and OY . InputInput The first line of input is 8 positive…
10396: H.Rectangles Time Limit: 2 Sec  Memory Limit: 128 MB Submit: 229  Solved: 33 [Submit][Status][Web Board] Description Given N (4 <= N <= 100)  rectangles and the lengths of their sides ( integers in the range 1..1,000), write a program that fi…
10574 - Counting Rectangles 题目链接 题意:给定一些点,求可以成几个边平行于坐标轴的矩形 思路:先把点按x排序,再按y排序.然后用O(n^2)的方法找出每条垂直x轴的边,保存这些边两点的y坐标y1, y2.之后把这些边按y1排序,再按y2排序.用O(n)的方法找出有几个连续的y1, y2都相等.那么这些边两两是能构成矩形的.为C2cnt种.然后累加起来就是答案 代码: #include <stdio.h> #include <string.h> #inc…
Rectangles time limit per test 5 seconds memory limit per test 256 megabytes input standard input output standard output Given an R×C grid with each cell containing an integer, find the number of subrectangles in this grid that contain only one disti…
Cow Rectangles 题目描述 The locations of Farmer John's N cows (1 <= N <= 500) are described by distinct points in the 2D plane.  The cows belong to two different breeds: Holsteins and Guernseys.  Farmer John wants to build a rectangular fence with sides…
Rectangles Time Limit: 5000/4000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1259    Accepted Submission(s): 661 Problem Description You are developing a software for painting rectangles on the screen. The softwa…
Given two rectangles, find if the given two rectangles overlap or not. A rectangle is denoted by providing the x and y co-ordinates of two points: the left top corner and the right bottom corner of the rectangle. Note that two rectangles sharing a si…
Given a grid where each entry is only 0 or 1, find the number of corner rectangles. A corner rectangle is 4 distinct 1s on the grid that form an axis-aligned rectangle. Note that only the corners need to have the value 1. Also, all four 1s used must…
Given a list of non-overlapping axis-aligned rectangles rects, write a function pick which randomly and uniformily picks an integer point in the space covered by the rectangles. Note: An integer point is a point that has integer coordinates. A point …
Given a list of non-overlapping axis-aligned rectangles rects, write a function pick which randomly and uniformily picks an integer point in the space covered by the rectangles. Note: An integer point is a point that has integer coordinates. A point …
CF1083E The Fair Nut and Rectangles 给定 \(n\) 个平面直角坐标系中左下角为坐标原点,右上角为 \((x_i,\ y_i)\) 的互不包含的矩形,每一个矩形拥有权值 \(a_i\) .你的任务是选出若干个矩形,使得选出的矩形的面积并减去矩形的权值之和尽可能大.输出最大值. \(1\leq n\leq10^6,\ 1\leq x_i,\ y_i\leq10^9,\ 0\leq a_i\leq x_i\cdot y_i\) 斜率优化 因为所有矩阵互不包含,所以…
题目链接: G - Intersecting Rectangles Kattis - intersectingrectangles 题目大意:给你n个矩形,每一个矩形给你这个矩形的左下角的坐标和右上角的坐标,然后问你这些矩形会不会相交,如果存在相交的点,输出1,否则输出0. 具体思路:扫描线,我们首先对x进行排序,然后判断当前x直线对应的线段上是否有x已经覆盖,如果已经有就证明存在相交的情况.但是这样会存在多算的情况,所以我们对于每一个矩形的左端点打一个标记,然后右端点再打一个标记,当左端点的时…
题目链接:http://codeforces.com/gym/101020/problem/C C. Rectangles time limit per test 2.0 s memory limit per test 64 MB input standard input output standard output You have n rectangles, each of which is described by three integers i, j and k. This indic…
D. Counting Rectangles is Fun time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output There is an n × m rectangular grid, each cell of the grid contains a single integer: zero or one. Let's call t…
There are nnn rectangles on the plane. The problem is to find the area of the union of these rectangles. Note that these rectangles might overlap with each other, and the overlapped areas of these rectangles shall not be counted more than once. For e…
You are developing a software for painting rectangles on the screen. The software supports drawing several rectangles and filling some of them with a color different from the color of the background. You are to implement an important function. The fu…