QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#609414 | #9434. Italian Cuisine | nekoyellow | RE | 0ms | 3584kb | C++20 | 1.4kb | 2024-10-04 12:50:29 | 2024-10-04 12:50:29 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const char nl = '\n';
#define watch(x) cout << (#x) << ": " << (x) << endl
using pt = complex<ll>;
int dot(pt a, pt b) { // dot product
return real(conj(a)*b);
}
int cross(pt a, pt b) { // cross product
return imag(conj(a)*b);
}
bool diff(ll x, ll y) {
return (x > 0) ^ (y > 0);
}
void solve() {
int n;
cin >> n;
int X, Y, R;
cin >> X >> Y >> R;
pt P(X, Y);
vector<pt> a(n);
for (int i = 0; i < n; i++) {
int xx, yy;
cin >> xx >> yy;
a[i] = {xx, yy};
}
for (int i = 0; i < n; i++) {
a.push_back(a[i]);
}
int l = 0, r = 1;
ll sz = 0, ans = 0;
while (l < n) {
while (r < 2*n-1) {
pt v1 = P - a[l], v2 = a[r] - a[l], v3 = a[r+1] - a[l];
if (diff(cross(v1, v2), cross(v1, v3))) break;
if (cross(v1, v3) * cross(v1, v3) / dot(v3, v3) < R*R) break;
sz += abs(cross(v2, v3));
r++;
// cout << a[l] << ' ' << a[r] << ' ' << sz << endl;
}
ans = max(ans, sz);
sz -= abs(cross(a[l] - a[r], a[l+1] - a[r]));
l++;
}
cout << ans << nl;
}
signed main() {
cin.tie(0)->sync_with_stdio(0);
int t;
cin >> t;
for (; t; t--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3584kb
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
Runtime Error
input:
1 6 0 0 499999993 197878055 -535013568 696616963 -535013568 696616963 40162440 696616963 499999993 -499999993 499999993 -499999993 -535013568