$n \leq 100000$个点,$m \leq 100000$次询问,每次问删掉一些点后的凸包面积。

不会啦写个20暴力,其实是可以写到50的。当个计算几何板子练习。

 //#include<iostream>
#include<cstring>
#include<cstdio>
//#include<math.h>
//#include<set>
//#include<queue>
//#include<bitset>
//#include<vector>
#include<algorithm>
#include<stdlib.h>
using namespace std; #define LL long long
int qread()
{
char c; int s=,f=; while ((c=getchar())<'' || c>'') (c=='-') && (f=-);
do s=s*+c-''; while ((c=getchar())>='' && c<=''); return s*f;
} //Pay attention to '-' , LL and double of qread!!!! int n,m;
#define maxn 100011
int Abs(int x) {return x>?x:-x;}
struct Poi
{
int x,y;
LL operator * (const Poi &b) const {return 1ll*x*b.y-1ll*y*b.x;}
Poi operator - (const Poi &b) const {return (Poi){x-b.x,y-b.y};}
bool operator < (const Poi &b)
{
if (x== && y==) return ;
if (b.x== && b.y==) return ;
Poi c=(Poi){,};
LL tmp=(c-(*this))*(c-b);
return tmp> || (tmp== && Abs(x)<Abs(b.x));
}
}p[maxn],q[maxn],sta[maxn]; int lq,top;
bool vis[maxn]; int main()
{
n=qread(); m=qread();
for (int i=;i<=n;i++) {p[i].x=qread(); p[i].y=qread();} LL s=-;
int K,op;
while (m--)
{
memset(vis,,sizeof(vis));
K=qread();
while (K--) vis[(qread()+s+n)%n+]=;
int my=0x3f3f3f3f,id=; lq=top=;
for (int i=;i<=n;i++) if (!vis[i])
{
q[++lq]=p[i];
if (p[i].y<my) {my=p[i].y; id=lq;}
}
for (int i=;i<=lq;i++) if (i!=id) q[i].x-=q[id].x,q[i].y-=q[id].y; q[id].x=q[id].y=;
sort(q+,q++lq);
// for (int i=1;i<=lq;i++) cout<<q[i].x<<' '<<q[i].y<<endl;cout<<endl;
sta[++top]=q[lq];
for (int i=;i<=lq;i++)
{
while (top> && (sta[top]-sta[top-])*(q[i]-sta[top])<=) top--;
sta[++top]=q[i];
}
// for (int i=1;i<=top;i++) cout<<sta[i].x<<' '<<sta[i].y<<endl; cout<<endl;
s=;
for (int i=;i<top;i++) s+=sta[i]*sta[i+];
printf("%lld\n",s);
}
return ;
}

LOJ#2307. 「NOI2017」分身术的更多相关文章

  1. loj #2305. 「NOI2017」游戏

    #2305. 「NOI2017」游戏 题目描述 小 L 计划进行 nnn 场游戏,每场游戏使用一张地图,小 L 会选择一辆车在该地图上完成游戏. 小 L 的赛车有三辆,分别用大写字母 AAA.BBB. ...

  2. loj#2305. 「NOI2017」游戏 2-sat

    链接 https://loj.ac/problem/2305 https://www.luogu.org/problemnew/show/P3825 思路 3-sat神马的就不要想了,NP问题 除去x ...

  3. LOJ 2304 「NOI2017」泳池——思路+DP+常系数线性齐次递推

    题目:https://loj.ac/problem/2304 看了各种题解…… \( dp[i][j] \) 表示有 i 列.第 j 行及以下默认合法,第 j+1 行至少有一个非法格子的概率,满足最大 ...

  4. LOJ 2303 「NOI2017」蚯蚓排队——链表+哈希表

    题目:https://loj.ac/problem/2303 想到合并的时候可以只考虑接口附近的50个,但不太会分析复杂度,而且没有清楚地想到用哈希值对应个数. 看了题解才会…… 一直想用 splay ...

  5. LOJ 2302 「NOI2017」整数——压位线段树

    题目:https://loj.ac/problem/2302 压30位,a最多落在两个位置上,拆成两次操作. 该位置加了 a 之后,如果要进位或者借位,查询一下连续一段 0 / 1 ,修改掉,再在含有 ...

  6. *LOJ#2306. 「NOI2017」蔬菜

    $n \leq 100000$种蔬菜,每个蔬菜有:一单位价格:卖第一单位时额外价格:总量:每天腐烂量.每天能卖$m \leq 10$单位蔬菜,多次询问:前$k \leq 100000$天最多收入多少. ...

  7. LOJ#2304. 「NOI2017」泳池

    $n \leq 1e9$底边长的泳池,好懒啊泥萌自己看题吧,$k \leq 1000$.答案对998244353取膜. 现在令$P$为安全,$Q$为危险的概率.刚好$K$是极其不好算的,于是来算$\l ...

  8. LOJ#2303. 「NOI2017」蚯蚓排队

    $n \leq 200000$的$1 \leq a_i \leq 6$的蚯蚓,有三种操作:让一只队头蚯蚓接在一只队尾蚯蚓后面:让一队蚯蚓从某个蚯蚓后面断成两队:问:给个字符串,问他的..算了你们直接看 ...

  9. LOJ#2302. 「NOI2017」整数

    $n \leq 1000000$个操作:一,给$x$加上$a*2^b$:二,问$x$的某个二进制位$k$.$b,k \leq 30n$,$|a| \leq 1e9$. 30暴露了一切..可以把30个二 ...

随机推荐

  1. python使用PyQt5,及QtCreator,qt-unified界面设计以及逻辑实现

    1.环境安装: 1.安装pyQt5 pip3 install pyQt5   2.安装设计器 pip3 install pyQt5-tools  (英文版的) 我是用的是自己Windows上安装的qt ...

  2. 748. Shortest Completing Word

    https://leetcode.com/problems/shortest-completing-word/description/ class Solution { public: string ...

  3. 动态规划:HDU1248-钱币兑换问题

    解题心得: (青蛙跳台阶:有n阶台阶,青蛙可以一次跳一阶也可以一次跳两阶,问总共有多好中跳法) 1.之前把这个问题的思路弄错了,以为是递推,就像青蛙跳台阶,用斐波那契求解.但是用斐波那契肯定会超范围. ...

  4. [Bzoj2588]Count on a tree(主席树+LCA)

    Description 给定一棵N个节点的树,每个点有一个权值,对于M个询问(u,v,k),你需要回答u xor lastans和v这两个节点间第K小的点权.其中lastans是上一个询问的答案,初始 ...

  5. f触发器、存储过程

    drop trigger trig_insert--删除触发器

  6. Keepalivaed +Nginx proxy 高可用架构方案与实施过程细节

    1.开源产品介绍 1)CMS介绍 官方网站http://www.dedecms.com/,是一个网站应用系统构建平台,也是一个强大的网站内容管理系统,既可以用来构建复杂的体系的企业信息门户或者电子商务 ...

  7. Contest - 中南大学第六届大学生程序设计竞赛(Semilive)

    题1:1160十进制-十六进制 注意他给的数据范围 2^31,int是 2^31-1 #include<iostream> using namespace std; int main() ...

  8. OpenCV学习笔记(七) 图像金字塔 阈值 边界

    转自: OpenCV 教程 使用 图像金字塔 进行缩放 图像金字塔是视觉运用中广泛采用的一项技术.一个图像金字塔是一系列图像的集合 - 所有图像来源于同一张原始图像 - 通过梯次向下采样获得,直到达到 ...

  9. datetime模块详解

    时间运算 >>> datetime.datetime.now() #当前年月 时间datetime.datetime(2018, 2, 13, 16, 12, 6, 850532)& ...

  10. 扩展MarkDown表格

    一直不知道表格中的:是什么意思,看了GcsSloop的这篇文章后恍然大悟,做下记录. 原文链接 第二行分割线部分可以使用 : 来控制内容状态 MarkDown : | 默认 | 靠右 | 居中 | 靠 ...