QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#748621 | #9434. Italian Cuisine | xzin# | WA | 3ms | 8496kb | C++14 | 1.8kb | 2024-11-14 20:53:35 | 2024-11-14 20:53:42 |
Judging History
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[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: 3ms
memory: 8496kb
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: 8484kb
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