$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. 初识Java程序,编写简单代码?

    Dear All: 初识Java程序,编写简单代码? 首先小编在这里说下我们今天编写Java程序使用的是 eclipse 开发工具! 1.下载eclipse 官网地址:http://www.eclip ...

  2. AB test学习笔记

    AB Test 介绍: https://vwo.com/ab-testing/ AB Test 的意义: 数据分析告诉我们要不要去做一件事情,ab 实验反馈告诉我们我们做得好不好,哪里有问题,以及衡量 ...

  3. 大数据的存储——HBase、HIVE、MYSQL数据库学习笔记

    HBase 1.hbase为查询而生,它通过组织机器的内存,提供一个超大的内存hash表,它需要组织自己的数据结构,表在hbase中是物理表,而不是逻辑表,搜索引擎用它来存储索引,以满足实时查询的需求 ...

  4. 初级React入门

    一.引入Reactjs 方法一:直接下载相关js文件引入网页,其中react.js 是 React 的核心库,react-dom.js 是提供与 DOM 相关的功能,Browser.js 的作用是将 ...

  5. ecshop里操作session与cookie

    目录 操作session 操作cookie html模板里提交保存用用户名 php里 js里保存cookie js里读取cookie html模板里smart的保留变量 html模板里取session ...

  6. Linux 面试的一些基础命令

    1.查询服务器负载 (1)uptime [root@oldboy ~]# uptime 20:17:18 up 7:41, 2 users, load average: 0.00, 0.00, 0.0 ...

  7. Terrorist’s destroy HDU - 4679

    Terrorist’s destroy HDU - 4679 There is a city which is built like a tree.A terrorist wants to destr ...

  8. A1083 List Grades (25)(25 分)

    A1083 List Grades (25)(25 分) Given a list of N student records with name, ID and grade. You are supp ...

  9. DFS:POJ1190-生日蛋糕(基础搜索)

    生日蛋糕 Time Limit: 1000MS Memory Limit: 10000K 描述 7月17日是Mr.W的生日,ACM-THU为此要制作一个体积为Nπ的M层生日蛋糕,每层都是一个圆柱体. ...

  10. js:随记

    typeof:没有大写,因为typeof是运算符 *1:是转数字 +string:是转数字,在Date对象上是getTime ""+:是转字符串 "":bool ...