传送门 •题意 给你三个矩形,依次编号为 1,2,3: 判断 矩形1 是否被 矩形2 和 矩形3 完全覆盖: 如果没有完全覆盖,输出 "YES",反之,输出 "NO": •题解 我是用扫描线做的: 首先,定义如下数据结构: struct Data { int x; int y1,y2; int f; int id; bool operator < (const Data& obj)const { return x < obj.x; } }line…
1845: [Cqoi2005] 三角形面积并 Time Limit: 3 Sec  Memory Limit: 64 MBSubmit: 1151  Solved: 313[Submit][Status][Discuss] Description 给出n个三角形,求它们并的面积. Input 第一行为n(N < = 100), 即三角形的个数 以下n行,每行6个整数x1, y1, x2, y2, x3, y3,代表三角形的顶点坐标.坐标均为不超过10 ^ 6的实数,输入数据保留1位小数 Out…
题面 传送门 前置芝士 扫描线,积分求面积 题解 我怎么老是忘了积分可以求面积-- 首先,这两个投影的最小的\(x\)坐标和最大的\(x\)坐标必须相等,否则肯定无解 我们考虑一种方法,枚举\(x\)坐标,并令每一个\(x\)处对应的多边形的面积最大.只有每一个\(x\)处面积都取最大,多面体的体积才能取到最大值 怎么样才能让对应的多边形面积最大呢?我们令\(h(c)\)表示\(xy\)平面上\(x=c\)处投影的长度之和,令\(g(c)\)表示\(xz\)平面上\(x=c\)处的投影长度之和.…
  C. Five Dimensional Points time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincid…
给你最多1000个圆,问画一条直线最多能与几个圆相交,相切也算. 显然临界条件是这条线是某两圆的公切线,最容易想到的就是每两两圆求出所有公切线,暴力判断一下. 可惜圆有1000个,时间复杂度太高. 网上题解的做法是枚举每个“中心圆”,求出这个圆与其他圆的切线,然后按极角排序,扫一圈. 把每条切线看成扫入线——添加一个圆,或扫出线——删除一个圆. 形象一点就是一条与中心圆相切的直线,沿着中心圆滚了一圈,当这个直线碰到其他圆时,是添加了一个圆还是删除了一个圆. PS:这题C++交死活TLE,G++才…
要点 用A.B.C一般式确定每条直线 将合法的圆心中点存到每条直线所属的vector中 枚举所有线段,二分后\(O(1)\)得到其中存在多少答案,累加 #include <cstdio> #include <cmath> #include <cstring> #include <iostream> #include <algorithm> #include <iomanip> #include <vector> #incl…
C. Chris and Road time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output And while Mishka is enjoying her trip... Chris is a little brown bear. No one knows, where and when he met Mishka, but for…
C. Constellation time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Cat Noku has obtained a map of the night sky. On this map, he found a constellation with n stars numbered from 1 to n. For…
A. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to .…
题意: 平面上有几个宽度相同的矩形区域被涂黑了,让你找到一条横线横截若干个矩形,把这些黑色部分抠下来一部分使得它们以这条横线为对称轴,求能抠下来的最大面积. 题解: 在随着对称轴上移的过程中,必然有一部分矩形有效面积在增加,一部分有效面积在减少,一部分有效面积不变. 单个矩形状态发生变化时,仅当对称轴触及下端点,中点,上端点时. 因此预处理出所有矩形的这三个突变点的信息并离散化,然后从下往上遍历,记录每一个时间点这三种状态的矩形共有多少个,以此递推面积. 最优解一定在突变点处出现,记录即可. 为…