想当年……还是邱神给我讲的凸包来着……

#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#define eps 0.000000001
#define enter putchar('\n')
#define space putchar(' ')
using namespace std;
typedef long long ll;
template <class T>
void read(T &x){
char c;
bool op = 0;
while(c = getchar(), c < '0' || c > '9')
if(c == '-') op = 1;
x = c - '0';
while(c = getchar(), c >= '0' && c <= '9')
x = x * 10 + c - '0';
if(op) x = -x;
}
template <class T>
void write(T x){
if(x < 0) putchar('-'), x = -x;
if(x >= 10) write(x / 10);
putchar('0' + x % 10);
}
const int N = 10005, INF = 0x3f3f3f3f;
int n, top, ans;
struct point {
int x, y;
point(){}
point(int _x, int _y): x(_x), y(_y){}
point operator - (point b) const{
return point(x - b.x, y - b.y);
}
int operator * (point b){
return x * b.y - y * b.x;
}
int norm(){
return x * x + y * y;
}
} p[N], stk[N], root;
bool operator < (const point &a, const point &b){
int det = (a - root) * (b - root);
if(det) return det > 0;
return (a - root).norm() < (b - root).norm();
}
void graham(){
int pos = 0;
root.x = root.y = INF;
for(int i = 1; i <= n; i++)
if(p[i].x < root.x || (p[i].x == root.x && p[i].y < root.y))
root = p[i], pos = i;
if(pos != 1) swap(p[pos], p[1]);
sort(p + 2, p + n + 1);
stk[top = 1] = root;
for(int i = 2; i <= n; i++){
while(top >= 2 && (stk[top] - stk[top - 1]) * (p[i] - stk[top - 1]) < 0) top--;
stk[++top] = p[i];
}
}
void getarea(){
stk[top + 1] = stk[1];
for(int i = 1; i <= top; i++)
ans += stk[i] * stk[i + 1];
}
int main(){
read(n);
for(int i = 1; i <= n; i++)
read(p[i].x), read(p[i].y);
graham();
getarea();
write(ans / 2 / 50), enter;
return 0;
}

最新文章

  1. 解决Onedrive经常无法访问的问题
  2. Remove Duplicates from Sorted Array II [LeetCode]
  3. HR常用事务代码
  4. Markdown:认识&amp;入门
  5. Hybrid App简介
  6. c++中的 extern &quot;C&quot;(转载)
  7. js刷新
  8. android4.4短信新概念
  9. Codeforces Round #343 (Div. 2) D - Babaei and Birthday Cake 线段树+DP
  10. WINAPI大全~
  11. c#基础语句——分支语句的应用
  12. redis的安装部署启动停止&lt;17.3.21已更新&gt;
  13. python捕获异常、处理异常
  14. 2017-12-19python全栈9期第四天第二节之列表的增删查改之删除的pop和del和remove和clear
  15. print()与println()区别
  16. yii添加验证码 和重复密码
  17. Java-函数式编程(一)初识篇
  18. A02-java学习-classpath配置-标识符-java变量类型
  19. 小记之while循环条件的操作位置
  20. Navi.Soft31.代码生成器(含下载地址)

热门文章

  1. [学习笔记]PCL使用心得
  2. python OptionParser模块使用
  3. 【SIKIA计划】_04_C#中级教程 (2015版)笔记
  4. OpenGL学习笔记(6) 基础光照的计算方法
  5. How to submit a package to PyPI
  6. javaweb 安全传输签名机制
  7. 个人作业-Week 1
  8. Task 9 从用户界面和体验分析“360极速浏览器”
  9. Ubuntu登录界面添加root用户登录选项
  10. beat冲刺(3/7)