QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#646469 | #9434. Italian Cuisine | retired_midlights | WA | 0ms | 3892kb | C++14 | 1.5kb | 2024-10-16 23:29:51 | 2024-10-16 23:29:52 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = (int)a; i <= (int)b; i ++)
#define per(i, a, b) for(int i = (int)a; i >= (int)b; i --)
// #define ll long long
using namespace std;
struct Point {
double x, y;
Point() {}
Point(double a, double b) { x = a, y = b; }
} ;
Point operator - (Point a, Point b) { return Point(a.x - b.x, a.y - b.y); }
double cross(Point a, Point b) { return a.x * b.y - a.y * b.x; }
double dis(Point a, Point b) { return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y)); }
void solve() {
int n;
cin >> n;
Point C;
cin >> C.x >> C.y;
double R;
cin >> R;
vector < Point > a(n);
rep(i, 0, n - 1) cin >> a[i].x >> a[i].y;
double res = 0, s = 0;
for(int l = 0, r = l + 1; l < n; l ++) {
while(1) {
int rr = (r + 1) % n;
double sgn = cross(C - a[l], a[rr] - a[l]);
// cerr << sgn << endl;
if(sgn >= 0) break;
if(-sgn < dis(a[l], a[rr]) * R) break;
s += cross(a[r] - a[l], a[rr] - a[l]);
r = rr;
}
// cerr << "l : " << l << " r : " << r << endl;
res = max(res, s);
int ll = (l + 1) % n;
s -= cross(a[ll] - a[l], a[r] - a[l]);
}
cout << res << endl;
}
int main() {
#ifdef LOCAL
freopen("data.in", "r", stdin);
#endif
ios :: sync_with_stdio(false);
cin.tie(0);
int T;
cin >> T;
cout << fixed << setprecision(10);
while(T --) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3892kb
input:
3 5 1 1 1 0 0 1 0 5 0 3 3 0 5 6 2 4 1 2 0 4 0 6 3 4 6 2 6 0 3 4 3 3 1 3 0 6 3 3 6 0 3
output:
5.0000000000 24.0000000000 0.0000000000
result:
wrong output format Expected integer, but "5.0000000000" found