QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#748588#9434. Italian Cuisinexzin#WA 2ms8588kbC++141.8kb2024-11-14 20:47:302024-11-14 20:47:31

Judging History

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

  • [2024-11-14 20:47:31]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:8588kb
  • [2024-11-14 20:47:30]
  • 提交

answer

#include <bits/stdc++.h>


#define N 301000

using namespace std;

struct Point{
    double x, y; Point(double X = 0, double Y = 0) {x = X, y = Y;}
    void in() {cin>>x>>y;}
};
int n;
double rc, sum = 0, ans = 0;
Point nd[N], c; 

Point operator+(Point a, Point b) {
    return Point(a.x + b.x, a.y + b.y);
}
Point operator-(Point a, Point b) {
    return Point(a.x - b.x, a.y - b.y);
}
bool operator==(Point a, Point b) {
    return (a.x == b.x && a.y == b.y);
}
double Dot(Point a, Point b) {
    return (a.x * b.x) + (a.y * b.y);
}
double Cro(Point a, Point b) {
    return (a.x * b.y) - (a.y * b.x);
}
double len(Point a) {
    return sqrt(Dot(a,a));
}
double dis(Point p, Point a, Point b) {
    if(a==b) return len(p - a);
    Point x = p - a, y = p - b, z = b - a;
    if(Dot(x, z) < 0) return len(x);
    if(Dot(y, z) > 0) return len(y);
    return fabs(Cro(x, z) / len(z));
}
double sjx(Point p, Point a, Point b) {
    if(p == a || p == b) return 0;
    Point x = p - a, y = p - b, z = b - a;
    return fabs(Cro(x, z));
}
bool check(Point a, Point b) {
    if(dis(c, a, b) >= rc) return 1;
    else  return 0;
}
bool mid(Point p, Point a, Point b) {
    Point x = a - p, y = b - p, z = c - p;
    if(Cro(x, z) * Cro(y, z) < 0) return 0;
    else return 1;
}
void sl() {
    
    cin>>n;
    c.in();
    cin>>rc;
    ans = sum = 0;
    int l = 1, r = 1;
    for(int i = 1;i <= n; i++) nd[i].in();
    for(int i = 1; i <= n; i++) {
        while (check(nd[i], nd[r]) && mid(nd[i], nd[r], nd[l])) {
            sum += sjx(nd[i], nd[r - 1], nd[r]);
            l = r; r++; if(r > n) r = 1; 
        } 
        ans = max(sum, ans);
        sum -= sjx(nd[r - 1], nd[i], nd[i + 1]);
    }
    cout<<ans<<"\n";
}
int main() {
    int T; cin>>T;
    while (T--) {
        sl();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 8588kb

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
24
0

result:

ok 3 number(s): "5 24 0"

Test #2:

score: -100
Wrong Answer
time: 2ms
memory: 8588kb

input:

1
6
0 0 499999993
197878055 -535013568
696616963 -535013568
696616963 40162440
696616963 499999993
-499999993 499999993
-499999993 -535013568

output:

2.86863e+17

result:

wrong output format Expected integer, but "2.86863e+17" found