GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 19 / 0 / 19
Functions: 100.0% 1 / 0 / 1
Branches: 57.1% 16 / 0 / 28

test/cpv_local/geo2d/ins_hps.bzoj4445.cpp
Line Branch Exec Source
1 // competitive-verifier: LOCALCASE test/cpv_local/_data/bzoj/4445
2
3 #include "../../../src/geo2d/ins_hps/lib.hpp"
4 #include "../../../src/io/container/lib.hpp"
5
6 using namespace tifa_libs;
7 using std::cin, std::cout;
8 using data_t = f128;
9 using Point2 = point<data_t>;
10 using Line2 = line<data_t>;
11 using Polygon2 = polygon<data_t>;
12 using ConvexHull2 = cvh<data_t>;
13
14 10 int main() {
15
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 cout << std::fixed << std::setprecision(4);
16 10 set_eps<data_t>(1e-18);
17
18 u32 n;
19
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 cin >> n;
20
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 vec<Point2> vp(n);
21 10 cin >> vp;
22 10 vec<Line2> vl;
23
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 vl.reserve(n * 2);
24
1/2
✓ Branch 3 taken 10 times.
✗ Branch 4 not taken.
10 vl.emplace_back(vp[0], vp[1]);
25
2/2
✓ Branch 0 taken 156269 times.
✓ Branch 1 taken 10 times.
156279 flt_ (u32, i, 1, n, nexti) {
26 156269 nexti = (i + 1) % n;
27 156269 data_t a = vp[1].y - vp[0].y - vp[nexti].y + vp[i].y;
28 156269 data_t b = vp[0].x - vp[1].x - vp[i].x + vp[nexti].x;
29 156269 data_t c = vp[1].x * vp[0].y - vp[0].x * vp[1].y + vp[i].x * vp[nexti].y - vp[nexti].x * vp[i].y;
30
1/2
✓ Branch 3 taken 156269 times.
✗ Branch 4 not taken.
156269 vl.emplace_back(vp[i], vp[nexti]);
31
3/4
✓ Branch 1 taken 156262 times.
✓ Branch 2 taken 7 times.
✓ Branch 4 taken 156262 times.
✗ Branch 5 not taken.
156269 if (!is_zero(a)) vl.emplace_back(-c / a, 0, b - c / a, -a);
32
2/4
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
7 else if (!is_zero(b)) vl.emplace_back(0, -c / b, b, -a - c / b);
33 }
34
3/6
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 9 taken 10 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 10 times.
✗ Branch 13 not taken.
10 cout << ins_hPs(vl).area() / Polygon2{vp}.area() << '\n';
35 10 }
36