```cpp
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<string>
#define line cout << endl
using namespace std;
const int NR = 1e5 + 5;
const double pi = 3.1415926535;
struct point {double x, y;};
int n, h, cnt;
double a, b, r, ans;
point p[NR], ps[NR];
double square (int xxx) {return xxx * xxx;}
bool cmp (point x, point y) {
if (x.y != y.y) return y.y > x.y;
return x.x > y.x;
}
double dis (point a, point b) {return sqrt (square (a.x - b.x) + square (a.y - b.y));}
double qaq (point a, point b, point c) {return a.x * b.y + a.y * c.x + b.x * c.y - a.x * c.y - a.y * b.x - b.y * c.x;}
void Convex_Hull () {
h = n + 1;
cnt = n + 1;
ps[cnt++] = p[1];
int i;
for (i = 1; i <= n; i++) {
ps[cnt] = p[i];
if (qaq (ps[n], p[i], p[i + 1]))
break;
}
if (n < 2) return;
ps[++cnt] = ps[--h] = p[++i];
if (qaq (ps[n - 1], ps[n], ps[n + 1]) < 0)
swap (ps[n - 1], ps[n]);
for (++i; i <= n; i++) {
if (qaq (ps[h + 1], ps[h], p[i]) < 0 && qaq (ps[cnt - 1], ps[cnt], p[i]) > 0)
continue;
while (cnt - h > 1 && qaq (ps[h + 1], ps[h], p[i]) >= 0)
h++;
ps[--h] = p[i];
while (cnt - h > 1 && qaq (ps[cnt - 1], ps[cnt], p[i]) <= 0)
cnt--;
ps[++cnt] = p[i];
}
}
int main () {
cin >> n;
cin >> a >> b >> r;
a -= r * 2;
b -= r * 2;
double diagonal = sqrt (square (a) + square (b)) / 2;
double pp[5];
pp[1] = atan (a / b);
pp[2] = pi - pp[1];
pp[3] = pi + pp[1];
pp[4] = 2 * pi - pp[1];
ans = r * 2 * pi;
for (int i = 1; i <= n * 4; i += 4) {
double x, y, th;
cin >> x >> y >> th;
for(int j = 1; j <= 4; j++) {
p[i + j - 1].x = cos (th + pp[j]) * diagonal + x;
p[i + j - 1].y = sin (th + pp[j]) * diagonal + y;
}
}
n *= 4;
sort (p + 1, p + n + 1, cmp);
Convex_Hull ();
for (int i = h; i < cnt; i++) {
ans += dis (ps[i], ps[i + 1]);
}
// cout << a;
printf ("%.2lf\n", ans);
return 0;
}
```
by 可爱 @ 2020-07-15 21:43:35
~~你咋随便一个凸包的题都要求助~~
by _5011_ @ 2020-07-15 21:46:00
这是graham吗(
by _5011_ @ 2020-07-15 21:47:08
@[Zephyr_](/user/91127) /jk /jk 蒻啊,没办法/kel
by 可爱 @ 2020-07-15 21:51:00
@[Lovable_TNT](/user/322108) 诶所以这到底是不是graham,我看不懂你写的是啥(
by _5011_ @ 2020-07-15 21:52:09
@[Zephyr_](/user/91127) 这不就是凸包的另一种求发吗(
by 可爱 @ 2020-07-15 21:53:36
@[Zephyr_](/user/91127) 不是 `graham` 吧(
by 可爱 @ 2020-07-15 21:54:36
草,我只会Graham和Jarvis,告辞
by _5011_ @ 2020-07-15 21:55:08
嘤
by 可爱 @ 2020-07-15 21:56:43
蒟蒻只能Orz
by IntrepidStrayer @ 2020-07-15 22:24:38