Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <algorithm>
- #include <functional>
- #include <set>
- using namespace std;
- typedef long long ll;
- template <class Num>
- struct Point {
- Num x, y;
- Point() {}
- Point(const Num& x, const Num& y) : x(x), y(y) {}
- bool operator<(const Point& p) const {
- if (x != p.x)
- return x < p.x;
- return y < p.y;
- }
- Point operator+(const Point& p) const {
- return Point(x + p.x, y + p.y);
- }
- Point operator-(const Point& p) const {
- return Point(x - p.x, y - p.y);
- }
- Point operator-() const {
- return Point(-x, -y);
- }
- Point operator*(const Num& a) const {
- return Point(x * a, y * a);
- }
- Point operator/(const Num& a) const {
- return Point(x / a, y / a);
- }
- Num operator^(const Point& p) const {
- return x * p.x + y * p.y;
- }
- Num operator*(const Point& p) const {
- return x * p.y - y * p.x;
- }
- friend Point operator*(const Num& a, const Point& p) {
- return Point(a * p.x, a * p.y);
- }
- };
- template <class Num>
- struct ConvexShell {
- typedef Point<Num> PointT;
- set<PointT> shell;
- void insert(const PointT& p) {
- set<PointT>::iterator it = shell.insert(p).first;
- if (it != shell.begin() && next(it))
- }
- PointT bound(const PointT& slope) const;
- };
- ConvexShell<ll> slope;
- int main() {
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment