QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#646573 | #9434. Italian Cuisine | xiachi | WA | 19ms | 3612kb | C++20 | 1.4kb | 2024-10-17 01:30:49 | 2024-10-17 01:30:49 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
struct Point {
LL x, y;
Point(LL x = 0, LL y = 0) : x(x), y(y) {}
void input() {
cin >> x >> y;
}
Point operator - (const Point& b) const {
return Point(x - b.x, y - b.y);
}
LL operator ^ (const Point& b) const {
return x * b.y - y * b.x;
}
LL length2() {
return x * x + y * y;
}
};
void solve() {
int n;
cin >> n;
Point c;
c.input();
LL r;
cin >> r;
vector<Point> p(n);
for (int i = 0; i < n; i++) {
p[i].input();
}
LL sum = 0, res = 0;
for (int i = 0, j = 1; i < n; i++) {
while (true) {
int k = (j + 1) % n;
LL s = (p[k] - p[i]) ^ (c - p[k]);
if (s > 0 && s * s / (r * r) >= (p[k] - p[i]).length2()) {
sum += (p[j] - p[i]) ^ (p[k] - p[j]);
j = k;
} else {
break;
}
}
res = max(res, sum);
if (sum > 0) {
// cout << i << ' ' << j << endl;
int u = (i + 1) % n;
int v = (i + 2) % n;
sum -= (p[u] - p[i]) ^ (p[v] - p[u]);
}
}
cout << res << endl;
}
int main() {
ios_base::sync_with_stdio(false);
int tt;
cin >> tt;
while (tt--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3552kb
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: 3552kb
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: 19ms
memory: 3612kb
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:
21442 7669 8112 823 9528 31067 16100 22221 23035 1771 5705 16684 16306 6357 12553 21859 7765 15800 10576 3230 3196 14505 14624 5822 18762 46314 3024 28461 1525 4229 16499 22071 12326 20004 30717 31623 2898 23808 31895 26341 22020 17700 8409 8871 3591 5850 11263 15948 20246 2715 13863 3247 1411 21516...
result:
wrong answer 1st numbers differ - expected: '5093', found: '21442'