QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#602692 | #9434. Italian Cuisine | Ycfhnnd | WA | 0ms | 3616kb | C++20 | 1.7kb | 2024-10-01 12:07:16 | 2024-10-01 12:07:18 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using i128 = __int128;
struct Point{
i64 x, y;
};
i64 cross(const Point &a, const Point &b){
return a.x * b.y - a.y * b.x;
}
i64 dot(const Point &a, const Point &b){
return a.x * b.x + a.y * b.y;
}
i64 mul(const Point &a){
return a.x * a.x + a.y * a.y;
}
Point operator -(const Point &a, const Point &b){
return {a.x - b.x, a.y - b.y};
}
void solve(){
int n;
cin >> n;
Point o;
i64 r;
cin >> o.x >> o.y >> r;
vector<Point>p(n);
for (int i = 0;i < n;i ++){
cin >> p[i].x >> p[i].y;
}
i64 ans = 0;
auto work = [&](int x){
i64 res = 0;
for (int l = 0, r = l + 1;l < n;l ++){
while (1){
int rr = r % n + 1;
i64 s = cross(p[rr] - p[l], o - p[l]);
if (x == 1){
if (s <= 0) break;
}else{
if (s >= 0) break;
}
if (s * s < mul(p[rr] - p[l]) * r * r){
break;
}
res += cross(p[r] - p[l], p[rr] - p[l]);
r = rr;
}
ans = max(ans, abs(res));
// cerr << l << " " << r << " " << res << " " << ans << "\n";
int ll = l % n + 1;
res -= cross(p[r] - p[l], p[r] - p[ll]);
}
};
work(1);
reverse(p.begin(), p.end());
work(0);
cout << ans << "\n";
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin >> T;
while (T --){
solve();
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3616kb
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 12 0
result:
wrong answer 2nd numbers differ - expected: '24', found: '12'