传送门

反正我是看不出来这题和凸包有什么关系……大佬们是怎么想到的……

不准确一点的说,本题就是要我们求一个边上点数最多的凸包

我们可以先把所有的边都取出来,然后按极角排序。枚举这个凸包的起点,然后做dp即可

复杂度\(O(n^3)\)

//minamoto
#include<bits/stdc++.h>
#define rint register int
using namespace std;
const int N=305;
struct node{int u,v;double x,y;}p[N],e[N*N];int f[N];
inline bool cmp(node a,node b){return atan2(a.x,a.y)<atan2(b.x,b.y);}
int main(){
// freopen("testdata.in","r",stdin);
int n,tot=0,ans=0;scanf("%d",&n);
for(rint i=1;i<=n;++i)scanf("%lf%lf",&p[i].x,&p[i].y);
for(rint i=1;i<=n;++i)for(rint j=1;j<=n;++j)if(i!=j){
e[++tot]={i,j,p[j].x-p[i].x,p[j].y-p[i].y};
}sort(e+1,e+1+tot,cmp);
for(rint i=1;i<=n;++i){
memset(f,0xef,sizeof(f));f[i]=0;
for(rint j=1;j<=tot;++j)
f[e[j].v]=max(f[e[j].v],f[e[j].u]+1);
ans=max(ans,f[i]);
}printf("%d\n",ans);return 0;
}

P2924 [USACO08DEC]大栅栏Largest Fence的更多相关文章

  1. BZOJ1591 & 洛谷2924:[USACO2008 DEC]Largest Fence 最大的围栏——题解

    http://www.lydsy.com/JudgeOnline/problem.php?id=1591 https://www.luogu.org/problemnew/show/P2924#sub ...

  2. bzoj AC倒序

    Search GO 说明:输入题号直接进入相应题目,如需搜索含数字的题目,请在关键词前加单引号 Problem ID Title Source AC Submit Y 1000 A+B Problem ...

  3. Java 特定规则排序-LeetCode 179 Largest Number

    Given a list of non negative integers, arrange them such that they form the largest number. For exam ...

  4. [LeetCode] Split Array Largest Sum 分割数组的最大值

    Given an array which consists of non-negative integers and an integer m, you can split the array int ...

  5. [LeetCode] Largest Divisible Subset 最大可整除的子集合

    Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of ...

  6. [LeetCode] Largest BST Subtree 最大的二分搜索子树

    Given a binary tree, find the largest subtree which is a Binary Search Tree (BST), where largest mea ...

  7. [LeetCode] Paint Fence 粉刷篱笆

    There is a fence with n posts, each post can be painted with one of the k colors. You have to paint ...

  8. [LeetCode] Kth Largest Element in an Array 数组中第k大的数字

    Find the kth largest element in an unsorted array. Note that it is the kth largest element in the so ...

  9. [LeetCode] Largest Number 最大组合数

    Given a list of non negative integers, arrange them such that they form the largest number. For exam ...

随机推荐

  1. STL中栈stack的用法

    头文件: #include <stack> 建立一个栈stack < 类型 > s //例如 stack<int> s 加入一个新的元素s.push( a ) 询问 ...

  2. eclipse 中为 java 项目生成 API 文档、JavaDoc

    当我们的项目很大,编写了很多代码的时候,就需要生成一个标准的 API 文档,让后续的开发人员,或者合作者可以清晰的了解您方法的使用. 1.点击 eclipse 的 Project 菜单,选择 Gene ...

  3. CCF201612-2 工资计算 java(100分)

    试题编号: 201612-2 试题名称: 工资计算 时间限制: 1.0s 内存限制: 256.0MB 问题描述: 问题描述 小明的公司每个月给小明发工资,而小明拿到的工资为交完个人所得税之后的工资.假 ...

  4. 三 , lnmp 一键包安装使用

    安装打包环境  #https://lnmp.org/----------------------------------------------------#安装wget -c http://soft ...

  5. Shock wave

    ** shock wave thickness of shock wave is order of 1e-7 m why governed by Euler Equation? P334 shock ...

  6. 关于python字典中文显示的处理办法

    最近工作中遇到字典包含中文,显示\uxxxx的问题,怎么转换都无法输入正常的中文:{"gc": "\u4eba\u751f\u7f8e\u597d", &quo ...

  7. STM32 配置PC13~PC15

    在STM32的数据手册的管脚分配图中可以看到:PC14与OSC32_IN公用一个引脚,PC15与OSC32_OUT公用一个引脚,它们的使用方法如下: 当LSE(低速外部时钟信号)开启时,这两个公用管脚 ...

  8. Spring 源码学习(一)

    工作好多年了,越来越心浮气躁了,好多东西都是一知半解的,所以现在需要静下心来好好学习一门技术. 就选Spring了, spring 设计java 开发的方方面面. 期待目标 对Spring 有个更深层 ...

  9. Ural 1036 Lucky Tickets

    Lucky Tickets Time Limit: 2000ms Memory Limit: 16384KB This problem will be judged on Ural. Original ...

  10. POJ 2115 简单的模线性方程求解

    简单的扩展欧几里得题 这里 2^k 不能自作聪明的用 1<<k来写 , k >= 31时就爆int了 , 即使定义为long long 也不能直接这样写 后来老老实实 for(int ...