QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#646469#9434. Italian Cuisineretired_midlightsWA 0ms3892kbC++141.5kb2024-10-16 23:29:512024-10-16 23:29:52

Judging History

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

  • [2024-10-16 23:29:52]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3892kb
  • [2024-10-16 23:29:51]
  • 提交

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