QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#748822#9434. Italian CuisinexzinWA 55ms3908kbC++142.0kb2024-11-14 21:35:242024-11-14 21:35:25

Judging History

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

  • [2024-11-14 21:35:25]
  • 评测
  • 测评结果:WA
  • 用时:55ms
  • 内存:3908kb
  • [2024-11-14 21:35:24]
  • 提交

answer

#include <bits/stdc++.h>


#define N 3010

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;
long long 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);
    // double k = Cro(x, z), kk = len(z);
    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) {
    // cout<<dis(c, a, b)<<endl;
    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++) {
        if(l < i) l = i;
        if(r < i) r = i;
        while (check(nd[i], nd[r]) && mid(nd[i], nd[r], nd[l])) {
            sum += sjx(nd[i], nd[l], 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();
    }
}

详细

Test #1:

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

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: 0
Accepted
time: 0ms
memory: 3844kb

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #3:

score: -100
Wrong Answer
time: 55ms
memory: 3736kb

input:

6666
19
-142 -128 26
-172 -74
-188 -86
-199 -157
-200 -172
-199 -186
-195 -200
-175 -197
-161 -188
-144 -177
-127 -162
-107 -144
-90 -126
-87 -116
-86 -104
-89 -97
-108 -86
-125 -80
-142 -74
-162 -72
16
-161 -161 17
-165 -190
-157 -196
-154 -197
-144 -200
-132 -200
-128 -191
-120 -172
-123 -163
-138...

output:

16456
2862
1753
668
4991
24266
6621
30981
18930
1034
3589
8400
10167
3022
4996
8198
7495
12179
6325
1489
1884
10318
8487
1631
13296
67980
1692
30941
1548
1512
19615
11766
4592
25848
31155
31124
744
30238
53456
35096
27402
9559
2303
2728
2549
2187
3385
6205
22861
901
4334
1518
948
21535
1449
2376
318...

result:

wrong answer 1st numbers differ - expected: '5093', found: '16456'