总览:
以一个点为基准点,用角度维护凸包
插入一个点时,找到前驱后继,分别弹一下
可以用 set 维护
因为基准点在中间,所以用叉积判断方向时要先判象限
T1 #1249. SGU277 HERO 动态凸包
思路:
板子题
代码:
#include <bits/stdc++.h>
using namespace std;
#define LL long long
typedef unsigned long long ull;
typedef unsigned int uint;
#define pb push_back
#define mp make_pair
#define int long long
namespace IO {
char buf_[1 << 21], *p1_ = buf_, *p2_ = buf_;
#define ch() \
(p1_ == p2_ && \
(p2_ = (p1_ = buf_) + fread(buf_, 1, 1 << 21, stdin), p1_ == p2_) \
? EOF \
: *p1_++)
inline int in() {
int s = 0, f = 1;
char x = ch();
for (; x < '0' || x > '9'; x = ch())
if (x == '-') f = -1;
for (; x >= '0' && x <= '9'; x = ch()) s = (s * 10) + (x & 15);
return f == 1 ? s : -s;
}
char _buf[1 << 21];
int _p1 = -1;
inline void flush() {
fwrite(_buf, 1, _p1 + 1, stdout);
_p1 = -1;
}
inline void pc(char x) {
if (_p1 == (1 << 21) - 1) flush();
_buf[++_p1] = x;
}
inline void out(int x) {
char k[30];
int pos = 0;
if (!x) {
pc('0');
return