QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#684415#7310. Circular Sectorscrimson231Compile Error//C++1718.8kb2024-10-28 13:16:502024-10-28 13:16:50

Judging History

你现在查看的是最新测评结果

  • [2024-10-28 13:16:50]
  • 评测
  • [2024-10-28 13:16:50]
  • 提交

answer

]#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cassert>
#include <vector>
typedef long long ll;
typedef long double ld;
typedef std::vector<ld> Vld;
const ld INF = 1e17;
const ld TOL = 1e-13;
const ld PI = acosl(-1);
const int LEN = 505;
inline int sign(const ll& x) { return x < 0 ? -1 : !!x; }
inline int sign(const ld& x) { return x < -TOL ? -1 : x > TOL; }
inline bool zero(const ld& x) { return !sign(x); }
inline bool eq(const ld& u, const ld& v) { return zero(u - v); }
inline ll sq(ll x) { return x * x; }
inline ld norm(ld th) {
	while (th < 0) th += 2 * PI;
	while (sign(th - 2 * PI) >= 0) th -= 2 * PI;
	return th;
}
inline ld fit(ld x, ld lo, ld hi) { return std::min(hi, std::max(lo, x)); }

#define si lo
#define theta hi

#define LINE 1
#define CIRCLE 2

#define STRONG 0
#define WEAK 1

int N;
struct Pos {
	ld x, y;
	Pos(ld X = 0, ld Y = 0) : x(X), y(Y) {}
	bool operator == (const Pos& p) const { return zero(x - p.x) && zero(y - p.y); }
	bool operator != (const Pos& p) const { return !zero(x - p.x) || !zero(y - p.y); }
	bool operator < (const Pos& p) const { return zero(x - p.x) ? y < p.y : x < p.x; }
	Pos operator + (const Pos& p) const { return { x + p.x, y + p.y }; }
	Pos operator - (const Pos& p) const { return { x - p.x, y - p.y }; }
	Pos operator * (const ld& scalar) const { return { x * scalar, y * scalar }; }
	Pos operator / (const ld& scalar) const { return { x / scalar, y / scalar }; }
	ld operator * (const Pos& p) const { return x * p.x + y * p.y; }
	ld operator / (const Pos& p) const { return x * p.y - y * p.x; }
	Pos operator ^ (const Pos& p) const { return { x * p.x, y * p.y }; }
	Pos& operator += (const Pos& p) { x += p.x; y += p.y; return *this; }
	Pos& operator -= (const Pos& p) { x -= p.x; y -= p.y; return *this; }
	Pos& operator *= (const ld& scale) { x *= scale; y *= scale; return *this; }
	Pos& operator /= (const ld& scale) { x /= scale; y /= scale; return *this; }
	Pos operator - () const { return { -x, -y }; }
	Pos operator ~ () const { return { -y, x }; }
	Pos rot(ld the) const { return Pos(x * cos(the) - y * sin(the), x * sin(the) + y * cos(the)); }
	ld Euc() const { return x * x + y * y; }
	ld mag() const { return sqrt(Euc()); }
	Pos unit() const { return *this / mag(); }
	ld rad() const { return norm(atan2(y, x)); }
	friend ld rad(const Pos& p1, const Pos& p2) { return norm(atan2(p1 / p2, p1 * p2)); }
	inline friend std::istream& operator >> (std::istream& is, Pos& p) { is >> p.x >> p.y; return is; }
	inline friend std::ostream& operator << (std::ostream& os, const Pos& p) { os << p.x << " " << p.y; return os; }
};
ld cross(const Pos& d1, const Pos& d2, const Pos& d3) { return (d2 - d1) / (d3 - d2); }
ld cross(const Pos& d1, const Pos& d2, const Pos& d3, const Pos& d4) { return (d2 - d1) / (d4 - d3); }
int ccw(const Pos& d1, const Pos& d2, const Pos& d3) { return sign(cross(d1, d2, d3)); }
int ccw(const Pos& d1, const Pos& d2, const Pos& d3, const Pos& d4) { return sign(cross(d1, d2, d3, d4)); }
ld dot(const Pos& d1, const Pos& d2, const Pos& d3) { return (d2 - d1) * (d3 - d2); }
ld dot(const Pos& d1, const Pos& d2, const Pos& d3, const Pos& d4) { return (d2 - d1) * (d4 - d3); }
bool on_seg_strong(const Pos& d1, const Pos& d2, const Pos& d3) { return !ccw(d1, d2, d3) && sign(dot(d1, d3, d2)) >= 0; }
bool on_seg_weak(const Pos& d1, const Pos& d2, const Pos& d3) { return !ccw(d1, d2, d3) && sign(dot(d1, d3, d2)) > 0; }
bool collinear(const Pos& d1, const Pos& d2, const Pos& d3, const Pos& d4) { return !ccw(d1, d2, d3) && !ccw(d1, d2, d4); }
ld projection(const Pos& d1, const Pos& d2, const Pos& d3) { return dot(d1, d2, d3) / (d1 - d2).mag(); }
bool intersect(const Pos& s1, const Pos& s2, const Pos& d1, const Pos& d2) {
	bool f1 = ccw(s1, s2, d1) * ccw(s2, s1, d2) > 0;
	bool f2 = ccw(d1, d2, s1) * ccw(d2, d1, s2) > 0;
	//return f1 && f2;
	bool f3 = on_seg_strong(s1, s2, d1) ||
		on_seg_strong(s1, s2, d2) ||
		on_seg_strong(d1, d2, s1) ||
		on_seg_strong(d1, d2, s2);
	return (f1 && f2) || f3;
}
bool inside(const Pos& p0, const Pos& p1, const Pos& p2, const Pos& q, const int& f = STRONG) {
	if (ccw(p0, p1, p2) < 0) return ccw(p0, p1, q) >= f || ccw(p1, p2, q) >= f;
	return ccw(p0, p1, q) >= f && ccw(p1, p2, q) >= f;
}
Pos intersection(const Pos& p1, const Pos& p2, const Pos& q1, const Pos& q2) { ld a1 = cross(q1, q2, p1), a2 = -cross(q1, q2, p2); return (p1 * a2 + p2 * a1) / (a1 + a2); }
struct Seg {
	Pos s, e;
	Seg(Pos S = Pos(), Pos E = Pos()) : s(S), e(E) {}
	//ld green(const Pos& m, const ld& d) const { return m.y * d * (s.x - e.x); }
	ld green(const ld& lo, const ld& hi) const {
		ld d = hi - lo;
		ld ratio = (lo + hi) * .5;
		Pos m = s + (e - s) * ratio;
		return m.y * d * (s.x - e.x);
	}
	Pos p(const ld& rt) const { return s + (e - s) * rt; }
};
ld dot(const Seg& p, const Seg& q) { return dot(p.s, p.e, q.s, q.e); }
bool collinear(const Seg& p, const Seg& q) { return collinear(p.s, p.e, q.s, q.e); }
struct Circle {
	Pos c;
	int r;
	Circle(Pos C = Pos(), int R = 0) : c(C), r(R) {}
	bool operator == (const Circle& q) const { return c == q.c && r == q.r; }
	bool operator != (const Circle& q) const { return !(*this == q); }
	bool operator < (const Circle& q) const { return r < q.r && sign(sq((ll)r - q.r) - (c - q.c).Euc()) >= 0; }
	bool operator <= (const Circle& q) const { return r <= q.r && sign(sq((ll)r - q.r) - (c - q.c).Euc()) >= 0; }
	bool operator > (const Pos& p) const { return sign(r - (c - p).mag()) > 0; }
	bool operator >= (const Pos& p) const { return sign(r - (c - p).mag()) >= 0; }
	bool operator < (const Pos& p) const { return sign(r - (c - p).mag()) < 0; }
	bool operator <= (const Pos& p) const { return sign(r - (c - p).mag()) <= 0; }
	//bool meet(const Circle& q) const { return sign(sq((ll)r - q.r) - (c - q.c).Euc()) <= 0 && sign(sq((ll)r + q.r) - (c - q.c).Euc()) >= 0; }
	bool outside(const Circle& q) const { return sign((c - q.c).Euc() - sq((ll)r + q.r)) >= 0; }
	//bool outside(const Circle& q) const { return sign((c - q.c).mag() - ((ll)r + q.r)) >= 0; }
	ld area(const ld& lo, const ld& hi) const { return (hi - lo) * r * r * .5; }
	ld rad(const Pos& p) const { return (p - c).rad(); }
	ld green(const ld& lo, const ld& hi) const {
		Pos s = Pos(cos(lo), sin(lo)), e = Pos(cos(hi), sin(hi));
		ld fan = area(lo, hi);
		Pos m = c + (s + e) * r * (ld).5;
		ld tz = (cos(lo) - cos(hi)) * m.y * r;
		return fan + tz - (s / e) * r * r * (ld).5;
	}
	Pos p(const ld& t) const { return c + Pos(r, 0).rot(t); }
	inline friend std::istream& operator >> (std::istream& is, Circle& c) { is >> c.c >> c.r; return is; }
	inline friend std::ostream& operator << (std::ostream& os, const Circle& c) { os << c.c << " " << c.r; return os; }
};
bool cmpcr(const Circle& p, const Circle& q) { return p.c == q.c ? p.r < q.r : p.c < q.c; }
ld intersection(const Seg& s1, const Seg& s2) {
	const Pos& p1 = s1.s, p2 = s1.e, q1 = s2.s, q2 = s2.e;
	ld det = (q2 - q1) / (p2 - p1);
	if (zero(det)) return -1;
	ld a1 = ((q2 - q1) / (q1 - p1)) / det;
	ld a2 = ((p2 - p1) / (p1 - q1)) / -det;
	if (0 < a1 && a1 < 1 && -TOL < a2 && a2 < 1 + TOL) return a1;
	return -1;
}
Vld circle_line_intersections(const Seg& l, const Circle& q, const int& t = LINE) {
	//https://math.stackexchange.com/questions/311921/get-location-of-vector-circle-intersection
	Pos s = l.s, e = l.e;
	Pos vec = e - s;
	Pos OM = s - q.c;
	ld a = vec.Euc();
	ld b = vec * OM;
	ld c = OM.Euc() - q.r * q.r;
	ld J = b * b - a * c;
	if (J < -TOL) return {};
	ld det = sqrt(std::max((ld)0, J));
	ld lo = (-b - det) / a;
	ld hi = (-b + det) / a;
	Vld ret;
	if (t == LINE) {
		if (0 < lo && lo < 1) ret.push_back(lo);
		if (zero(det)) return ret;//remove dupl
		if (0 < hi && hi < 1) ret.push_back(hi);
	}
	else {//circle
		auto the = [&](ld rt) { return q.rad(s + (e - s) * rt); };
		if (-TOL < lo && lo < 1 + TOL) ret.push_back(the(lo));
		if (zero(det)) return ret;//remove dupl
		if (-TOL < hi && hi < 1 + TOL) ret.push_back(the(hi));
	}
	return ret;
}
Vld intersection(const Circle& a, const Circle& b) {
	Pos ca = a.c, cb = b.c;
	Pos vec = cb - ca;
	ll ra = a.r, rb = b.r;
	ld distance = vec.mag();
	ld rd = vec.rad();
	if (vec.Euc() > sq(ra + rb) + TOL) return {};
	if (vec.Euc() < sq(ra - rb) - TOL) return {};
	ld X = (ra * ra - rb * rb + vec.Euc()) / (2 * distance * ra);
	if (X < -1) X = -1;
	if (X > 1) X = 1;
	ld h = acos(X);
	Vld ret = {};
	ret.push_back(norm(rd - h));
	if (zero(h)) return ret;//remove dupl
	ret.push_back(norm(rd + h));
	return ret;
}
struct Arc {
	ld lo, hi;// [lo, hi] - radian range of arc, 0 ~ 2pi
	Arc(ld LO = 0, ld HI = 0) : lo(LO), hi(HI) {}
	bool operator < (const Arc& a) const { return zero(lo - a.lo) ? hi < a.hi : lo < a.lo; }
	//ld area(const Circle& cen) const { return (hi - lo) * cen.r * cen.r; }
	//ld green(const Circle& cen) const {
	//	Pos LO = -Pos(1, 0).rot(lo) * cen.r;
	//	Pos HI = Pos(1, 0).rot(hi) * cen.r;
	//	Pos vec = Pos(cen.c.x, cen.c.y);
	//	return (area(cen) + vec / (HI + LO)) * .5;
	//}
	//ld m() const {
	//	ld m_ = (lo + hi) * .5;
	//	if (sign(lo - hi) > 0) m_ = norm(m_ + PI);
	//	return m_;
	//}
	//Pos mid(const Circle& c) const { return c.c + Pos(c.r).rot(m()); }
	inline friend std::istream& operator >> (std::istream& is, Arc& a) { is >> a.lo >> a.hi; return is; }
	inline friend std::ostream& operator << (std::ostream& os, const Arc& a) { os << a.lo << " " << a.hi; return os; }
};
typedef std::vector<Arc> Arcs;
//void insert(Arcs& va, const Arc& a, const bool& rvs = 0) {
//	ld l = a.lo, h = a.hi;
//	if (rvs) std::swap(l, h);
//	if (l > h) { va.push_back(Arc(l, 2 * PI)); va.push_back(Arc(0, h)); }
//	else va.push_back(Arc(l, h));
//	return;
//}
struct Sector {
	Circle c;
	Arc a;
	Seg s1, s2;
	Arcs va, r1, r2;
	int val = -1;
	inline friend std::istream& operator >> (std::istream& is, Sector& s) { is >> s.c >> s.a; return is; }
	void init() {
		a.hi = norm(a.si + a.theta);
		std::swap(a.lo, a.hi);
		Pos lo = c.p(a.lo);
		Pos hi = c.p(a.hi);
		s1 = Seg(lo, c.c); s2 = Seg(c.c, hi);
		va.clear(); r1.clear(); r2.clear();
		val = 1;
	}
	bool outer_check(const Pos& q, const int& f = STRONG) const { return inside(s2.e, c.c, s1.s, q, f); }
	bool ccw() const { return sign(cross(s2.e, c.c, s1.s)); }
} S[LEN];
bool cmpc(const Sector& p, const Sector& q) { return cmpcr(p.c, q.c); }
bool inner_check(const Sector& s, const Pos& p, const int& f = STRONG) {
	assert(!eq(s.c.r, (s.c.c - p).mag()));
	if (s.c < p) return 0;
	return !s.outer_check(p, f == STRONG ? WEAK : STRONG);
}
void init() {
	std::sort(S, S + N, cmpc);
	for (int i = 0; i < N; i++) {
		const Arc& ai = S[i].a;
		Arcs uva;
		for (int j = 0; j < N; j++) {
			if (i == j) continue;
			const Circle& ci = S[i].c, cj = S[j].c;
			if (ci.outside(cj)) continue;
			const Arc& aj = S[j].a;
			const Seg& is1 = S[i].s1, is2 = S[i].s2;
			const Seg& js1 = S[j].s1, js2 = S[j].s2;
			if (ci == cj) {
				if (j < i) continue;
				while (j < N && ci == S[j].c) {
					S[j].val = 0;
					uva.push_back(S[j].a);
					if (!S[i].outer_check(js1.s, WEAK))
						S[j].r1.push_back(Arc(0, 1));
					if (!S[i].outer_check(js2.e, WEAK))
						S[j].r2.push_back(Arc(0, 1));
					if (!S[j].outer_check(is1.s, STRONG) || is1.s == js2.e)
						S[i].r1.push_back(Arc(0, 1));
					if (!S[j].outer_check(is2.e, STRONG) || is2.e == js1.s)
						S[i].r2.push_back(Arc(0, 1));
					j++;
				}
				j--;
				if (S[i].val) {
					S[i].val = 2;
					uva.push_back(S[i].a);
				}
				continue;
			}
			Vld tmp = { 0, 2 * PI };
			if (S[i].val) {
				Vld cc = intersection(ci, cj);
				Vld cs1 = circle_line_intersections(js1, ci, CIRCLE);
				Vld cs2 = circle_line_intersections(js2, ci, CIRCLE);
				tmp.insert(tmp.end(), cc.begin(), cc.end());
				tmp.insert(tmp.end(), cs1.begin(), cs1.end());
				tmp.insert(tmp.end(), cs2.begin(), cs2.end());
				std::sort(tmp.begin(), tmp.end());
				tmp.erase(unique(tmp.begin(), tmp.end(), eq), tmp.end());
				int sz = tmp.size();
				for (int k = 0; k < sz - 1; k++) {
					ld l = tmp[k], h = tmp[k + 1];
					ld m = (l + h) * .5;
					Pos mid = ci.p(m);
					if (inner_check(S[j], mid)) S[i].va.push_back(Arc(l, h));
				}
			}
			ld r1, r2, r3, r4;
			std::vector<Seg> IS = { is1, is2 };
			std::vector<Seg> JS = { js1, js2 };
			if (i < j) {
				for (int k = 1; k <= 2; k++) {
					for (int l = 1; l <= 2; l++) {
						const Seg& s1 = IS[k - 1];
						const Seg& s2 = JS[l - 1];
						if (collinear(s1, s2)) {
							r1 = projection(s1.s, s1.e, s2.s); r1 = fit(r1, 0, 1);
							r2 = projection(s1.s, s1.e, s2.e); r2 = fit(r2, 0, 1);
							r3 = projection(s2.s, s2.e, s1.s); r3 = fit(r3, 0, 1);
							r4 = projection(s2.s, s2.e, s1.e); r4 = fit(r4, 0, 1);
							if (l == 1) S[j].r1.push_back(Arc(r3, r4));
							if (l == 2) S[j].r2.push_back(Arc(r3, r4));
							if (dot(s1, s2) < 0) {
								if (k == 1) S[i].r1.push_back(Arc(r1, r2));
								if (k == 2) S[i].r2.push_back(Arc(r1, r2));
							}
						}
					}
				}
			}
			for (int t = 1; t <= 2; t++) {
				tmp = { (ld)0, (ld)1 };
				Vld ix1;
				Seg s1 = t == 1 ? is1 : is2;
				if (on_seg_strong(s1.s, s1.e, cj.c)) {
					ld ix = projection(s1.s, s1.e, cj.c);
					tmp.push_back(ix);
				}
				if (on_seg_strong(s1.s, s1.e, S[j].s1.s)) {
					ld ix = projection(s1.s, s1.e, S[j].s1.s);
					tmp.push_back(ix);
				}
				if (on_seg_strong(s1.s, s1.e, S[j].s2.e)) {
					ld ix = projection(s1.s, s1.e, S[j].s2.e);
					tmp.push_back(ix);
				}
				ix1 = circle_line_intersections(s1, cj, LINE);
				ld ix2 = intersection(s1, js1);
				ld ix3 = intersection(s1, js2);
				tmp.insert(tmp.end(), ix1.begin(), ix1.end());
				if (ix2 > -TOL) tmp.push_back(ix2);
				if (ix3 > -TOL) tmp.push_back(ix3);
				std::sort(tmp.begin(), tmp.end());
				tmp.erase(unique(tmp.begin(), tmp.end(), eq), tmp.end());
				int sz = tmp.size();
				for (int k = 0; k < sz - 1; k++) {
					ld l = tmp[k], h = tmp[k + 1];
					ld m = (l + h) * .5;
					Pos mid = s1.p(m);
					if (t == 1 && inner_check(S[j], mid, WEAK)) S[i].r1.push_back(Arc(l, h));
					if (t == 2 && inner_check(S[j], mid, WEAK)) S[i].r2.push_back(Arc(l, h));
				}
			}
		}
		if (S[i].val == 1) {
			ld lo = ai.lo, hi = ai.hi;
			if (lo > hi) {
				S[i].va.push_back(Arc(lo, 2 * PI));
				S[i].va.push_back(Arc(0, hi));
			}
			else S[i].va.push_back(Arc(lo, hi));
		}
		else if (S[i].val == 2) {
			//std::cout << "FUCK::\n";
			//uva.push_back(S[i].a);
			Arcs va;
			for (const Arc& a : uva) {
				ld lo = a.lo, hi = a.hi;
				if (lo < hi) {
					va.push_back(Arc(hi, 2 * PI));
					va.push_back(Arc(0, lo));
				}
				else va.push_back(Arc(hi, lo));
			}
			std::sort(va.begin(), va.end());
			va.push_back(Arc(2 * PI, 2 * PI));
			//for (const Arc& a : uva) std::cout << a.lo << " " << a.hi << " uva\n";
			//for (const Arc& a : va) std::cout << a.lo << " " << a.hi << " va\n";
			ld cur = 0;
			for (const Arc& a : va) {
				if (a.lo > cur) S[i].va.push_back(Arc(cur, a.lo)), cur = a.hi;
				else cur = std::max(cur, a.hi);
			}
		}
		std::sort(S[i].va.begin(), S[i].va.end());
		S[i].va.push_back(Arc(2 * PI, 2 * PI));
		std::sort(S[i].r1.begin(), S[i].r1.end());
		S[i].r1.push_back(Arc(1, 1));
		std::sort(S[i].r2.begin(), S[i].r2.end());
		S[i].r2.push_back(Arc(1, 1));
	}
	return;
}
ld green() {
	ld union_area = 0, hi = 0;
	for (int i = 0; i < N; i++) {
		if (S[i].val) {
			hi = 0;
			for (const Arc& a : S[i].va) {
				if (a.lo > hi) union_area += S[i].c.green(hi, a.lo), hi = a.hi;
				else hi = std::max(hi, a.hi);
			}
		}
		if (!eq(S[i].s1.s.x, S[i].s1.e.x)) {
			hi = 0;
			for (const Arc& a : S[i].r1) {
				if (a.lo > hi) union_area += S[i].s1.green(hi, a.lo), hi = a.hi;
				else hi = std::max(hi, a.hi);
			}
		}
		if (!eq(S[i].s2.s.x, S[i].s2.e.x)) {
			hi = 0;
			for (const Arc& a : S[i].r2) {
				if (a.lo > hi) union_area += S[i].s2.green(hi, a.lo), hi = a.hi;
				else hi = std::max(hi, a.hi);
			}
		}
	}
	return union_area;
}
void query() {
	for (int i = 0; i < N; i++) { std::cin >> S[i]; S[i].init(); }
	init();
	std::cout << green() << "\n";
	return;
}
void solve() {
	std::cin.tie(0)->sync_with_stdio(0);
	std::cout.tie(0);
	std::cout << std::fixed;
	std::cout.precision(15);
	while (std::cin >> N) query();
	return;
}
int main() { solve(); return 0; }//boj19368

/*

남은 구현 내용: 완전히 같은 원들은 병합해서 하나로 운용 가능. 한 개로 합치는 함수를 구현해야함.

2
1 1 1 0 0.5
1 1 1 0.4 6
0.162049691907653

*/


//struct Pii {
//	int x, y;
//	Pii(int X = 0, int Y = 0) : x(X), y(Y) {}
//	bool operator == (const Pii& p) const { return x == p.x && y == p.y; }
//	bool operator != (const Pii& p) const { return x != p.x || y != p.y; }
//	bool operator < (const Pii& p) const { return x == p.x ? y < p.y : x < p.x; }
//	bool operator <= (const Pii& p) const { return x == p.x ? y <= p.y : x <= p.x; }
//	Pii operator + (const Pii& p) const { return { x + p.x, y + p.y }; }
//	Pii operator - (const Pii& p) const { return { x - p.x, y - p.y }; }
//	Pii operator * (const int& n) const { return { x * n, y * n }; }
//	Pii operator / (const int& n) const { return { x / n, y / n }; }
//	ll operator * (const Pii& p) const { return { (ll)x * p.x + (ll)y * p.y }; }
//	ll operator / (const Pii& p) const { return { (ll)x * p.y - (ll)y * p.x }; }
//	Pii& operator += (const Pii& p) { x += p.x; y += p.y; return *this; }
//	Pii& operator -= (const Pii& p) { x -= p.x; y -= p.y; return *this; }
//	Pii& operator *= (const int& scale) { x *= scale; y *= scale; return *this; }
//	Pii& operator /= (const int& scale) { x /= scale; y /= scale; return *this; }
//	Pii operator - () const { return { -x, -y }; }
//	Pii operator ~ () const { return { -y, x }; }
//	Pii operator ! () const { return { y, x }; }
//	ll xy() const { return (ll)x * y; }
//	inline ll Euc() const { return (ll)x * x + (ll)y * y; }
//	inline ld rad() const { return norm(atan2(y, x)); }
//	int Man() const { return std::abs(x) + std::abs(y); }
//	ld mag() const { return hypot(x, y); }
//	inline friend std::istream& operator >> (std::istream& is, Pii& p) { is >> p.x >> p.y; return is; }
//	friend std::ostream& operator << (std::ostream& os, const Pii& p) { os << p.x << " " << p.y; return os; }
//};
//const Pii Oii = { 0, 0 };
//const Pii INF_PT = { (int)INF, (int)INF };
//inline ll cross(const Pii& d1, const Pii& d2, const Pii& d3) { return (d2 - d1) / (d3 - d2); }
//inline ll cross(const Pii& d1, const Pii& d2, const Pii& d3, const Pii& d4) { return (d2 - d1) / (d4 - d3); }
//inline ll dot(const Pii& d1, const Pii& d2, const Pii& d3) { return (d2 - d1) * (d3 - d2); }
//inline ll dot(const Pii& d1, const Pii& d2, const Pii& d3, const Pii& d4) { return (d2 - d1) * (d4 - d3); }
//inline int ccw(const Pii& d1, const Pii& d2, const Pii& d3) { return sign(cross(d1, d2, d3)); }

Details

answer.code:1:2: error: stray ‘#’ in program
    1 | ]#include <iostream>
      |  ^
answer.code:1:1: error: expected unqualified-id before ‘]’ token
    1 | ]#include <iostream>
      | ^
In file included from /usr/include/c++/13/bits/stl_algobase.h:62,
                 from /usr/include/c++/13/algorithm:60,
                 from answer.code:2:
/usr/include/c++/13/ext/type_traits.h:164:35: error: ‘constexpr const bool __gnu_cxx::__is_null_pointer’ redeclared as different kind of entity
  164 |   __is_null_pointer(std::nullptr_t)
      |                                   ^
/usr/include/c++/13/ext/type_traits.h:159:5: note: previous declaration ‘template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)’
  159 |     __is_null_pointer(_Type)
      |     ^~~~~~~~~~~~~~~~~
/usr/include/c++/13/ext/type_traits.h:164:26: error: ‘nullptr_t’ is not a member of ‘std’
  164 |   __is_null_pointer(std::nullptr_t)
      |                          ^~~~~~~~~
In file included from /usr/include/c++/13/bits/stl_pair.h:60,
                 from /usr/include/c++/13/bits/stl_algobase.h:64:
/usr/include/c++/13/type_traits:275:27: error: ‘size_t’ has not been declared
  275 |   template <typename _Tp, size_t = sizeof(_Tp)>
      |                           ^~~~~~
/usr/include/c++/13/type_traits:510:26: error: ‘std::size_t’ has not been declared
  510 |   template<typename _Tp, std::size_t _Size>
      |                          ^~~
/usr/include/c++/13/type_traits:511:25: error: ‘_Size’ was not declared in this scope
  511 |     struct is_array<_Tp[_Size]>
      |                         ^~~~~
/usr/include/c++/13/type_traits:511:31: error: template argument 1 is invalid
  511 |     struct is_array<_Tp[_Size]>
      |                               ^
/usr/include/c++/13/type_traits:617:33: error: ‘nullptr_t’ is not a member of ‘std’
  617 |     struct is_null_pointer<std::nullptr_t>
      |                                 ^~~~~~~~~
/usr/include/c++/13/type_traits:617:42: error: template argument 1 is invalid
  617 |     struct is_null_pointer<std::nullptr_t>
      |                                          ^
/usr/include/c++/13/type_traits:621:48: error: template argument 1 is invalid
  621 |     struct is_null_pointer<const std::nullptr_t>
      |                                                ^
/usr/include/c++/13/type_traits:625:51: error: template argument 1 is invalid
  625 |     struct is_null_pointer<volatile std::nullptr_t>
      |                                                   ^
/usr/include/c++/13/type_traits:629:57: error: template argument 1 is invalid
  629 |     struct is_null_pointer<const volatile std::nullptr_t>
      |                                                         ^
/usr/include/c++/13/type_traits:914:26: error: ‘size_t’ has not been declared
  914 |   template<typename _Tp, size_t _Size>
      |                          ^~~~~~
/usr/include/c++/13/type_traits:915:40: error: ‘_Size’ was not declared in this scope
  915 |     struct __is_array_known_bounds<_Tp[_Size]>
      |                                        ^~~~~
/usr/include/c++/13/type_traits:915:46: error: template argument 1 is invalid
  915 |     struct __is_array_known_bounds<_Tp[_Size]>
      |                                              ^
/usr/include/c++/13/type_traits:1348:37: error: ‘size_t’ is not a member of ‘std’
 1348 |     : public integral_constant<std::size_t, alignof(_Tp)>
      |                                     ^~~~~~
/usr/include/c++/13/type_traits:1348:57: error: template argument 1 is invalid
 1348 |     : public integral_constant<std::size_t, alignof(_Tp)>
      |                                                         ^
/usr/include/c++/13/type_traits:1348:57: note: invalid template non-type parameter
/usr/include/c++/13/type_traits:1357:37: error: ‘size_t’ is not a member of ‘std’
 1357 |     : public integral_constant<std::size_t, 0> { };
      |                                     ^~~~~~
/usr/include/c++/13/type_traits:1357:46: error: template argument 1 is invalid
 1357 |     : public integral_constant<std::size_t, 0> { };
      |                                              ^
/usr/include/c++/13/type_traits:1357:46: note: invalid template non-type parameter
/usr/include/c++/13/type_traits:1359:26: error: ‘std::size_t’ has not been declared
 1359 |   template<typename _Tp, std::size_t _Size>
      |                          ^~~
/usr/include/c++/13/type_traits:1360:21: error: ‘_Size’ was not declared in this scope
 1360 |     struct rank<_Tp[_Size]>
      |                     ^~~~~
/usr/include/c++/13/type_traits:1360:27: error: template argument 1 is invalid
 1360 |     struct rank<_Tp[_Size]>
      |                           ^
/usr/include/c++/13/type_traits:1361:37: error: ‘size_t’ is not a member of ‘std’
 1361 |     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
      |                                     ^~~~~~
/usr/include/c++/13/type_traits:1361:65: error: template argumen...