QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#623266 | #9434. Italian Cuisine | winlrjiahui | WA | 9ms | 3808kb | C++23 | 1.7kb | 2024-10-09 10:59:04 | 2024-10-09 10:59:04 |
Judging History
answer
#include <bits/stdc++.h>
#define lif " \n"
#define dbg(a) cout << #a << '=' << a << lif[1]
#define inf 0x3f3f3f3f
#define fi first
#define se second
#define cc(x) cout << fixed << setprecision(x);
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
using i128 = __int128;
using pii = pair<int, int>;
using pll = pair<i64, i64>;
using ld = long double;
const ld PI = acos(-1);
const ld EPS = 1e-7;
const ld INF = 1E18;
i64 cross(pii a, pii b, pii c) {
return (b.fi - a.fi) * (c.se - a.se) - (b.se - a.se) * (c.fi - a.fi);
}
i64 dtwo(i64 a, i64 b) {
return a * a + b * b;
}
void solve() {
int n;
cin >> n;
int x, y, r;
cin >> x >> y >> r;
vector<pll> a(n);
for (int i = 0; i < n; i++) cin >> a[i].fi >> a[i].se;
i64 ans = 0, s = 0;
for (int l = 0, r = l + 1; l < n; l++) {
if (l == r) r = (l + 1) % n;
while (1) {
int t = (r + 1) % n;
i64 ts = cross(a[l], a[t], {x, y});
// cerr << l << ' ' << r << ' ' << t << ' ' << ts << lif[1];
if (ts <= 0) break;
if ((i128)ts * ts < (i128)r * r * dtwo(a[t].fi - a[l].fi, a[t].se - a[l].se)) break;
i64 tmp = cross(a[l], a[r], a[t]);
// cerr << tmp << lif[1];
s += tmp;
r = t;
}
// cerr << l << ' ' << r << ' ' << s << lif[1];
ans = max(ans, s);
s -= cross(a[l], a[(l + 1) % n], a[r]);
}
cout << ans << lif[1];
}
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int t = 1;
cin >> t;
while (t--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3808kb
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: 3488kb
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: 9ms
memory: 3808kb
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:
10268 3170 4787 3348 7694 10098 6568 5364 6121 2400 2479 6770 7458 3610 9772 10519 4286 8861 10212 1648 2139 4837 5880 3278 5680 12787 2895 10705 814 2152 5566 8156 5995 9309 11503 9387 1013 5002 9129 6042 5978 6301 4128 4762 2219 2436 4126 10690 6484 2231 10087 1518 5305 6060 2505 8966 3180 4810 14...
result:
wrong answer 1st numbers differ - expected: '5093', found: '10268'