Repository navigation
Expand file tree
/
Copy pathtest.cpp
More file actions
79 lines (68 loc) · 1.92 KB
/
Copy pathtest.cpp
File metadata and controls
79 lines (68 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
* author : cellul4r
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
#define all(x) x.begin(), x.end()
const char nl = '\n';
const int N =2e5+1;
const int INF = 1e9+7;
const ll LINF = 1e18+7;
const int LG = 32;
void setIO(string);
template <class T> int sgn(T x) { return (x > 0) - (x < 0); }
template <class T>
struct Point {
typedef Point P;
T x,y;
explicit Point(T x = 0, T y = 0) : x(x), y(y) {}
bool operator<(P p) const { return tie(x,y) < tie(p.x,p.y); }
bool operator==(P p) const { return tie(x,y) == tie(p.x,p.y); }
P operator+(P p) const { return P(x+p.x, y+p.y); }
P operator-(P p) const { return P(x-p.x, y-p.y); }
P operator*(T d) const { return P(x*d, y*d); }
P operator/(T d) const { return P(x/d, y/d); }
T dot(P p) const { return x*p.x + y * p.y; }
T cross(P p) const { return x*p.y - y*p.x; }
T cross(P a, P b) const { return (a-*this).cross(b-*this); }
T dist2() const { return x*x + y*y; }
double dist() const { return sqrt((double)dist2()); }
};
template <class P>
double lineDist(const P& a, const P& b, const P& p) {
return (double)(b-a).cross(p-a)/(b-a).dist();
}
typedef Point<ll> P;
vector<P> convexHull(vector<P> pts) {
if (pts.size() <= 1) return pts;
sort(all(pts));
vector<P> h(pts.size()+1);
int s = 0, t = 0;
for (int it = 2; it--; s = --t, reverse(all(pts)))
for (P p : pts) {
while (t >= s + 2 && h[t-2].cross(h[t-1], p) <= 0) t--;
h[t++] = p;
}
return {h.begin(), h.begin() + t - (t == 2 && h[0] == h[1])};
}
void solve(){
int n; cin>>n;
for
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
//setIO("");
cin>>t;
while(t--)solve();
return 0;
}
void setIO(string s) {
(void)!freopen((s + ".in").c_str(), "r", stdin);
(void)!freopen((s + ".out").c_str(), "w", stdout);
}