QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#187339 | #3854. Radar | SocialZxy# | WA | 1ms | 3712kb | C++14 | 1.6kb | 2023-09-24 16:29:56 | 2023-09-24 16:29:57 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
int get() {
int x = 0, f = 1; char c = getchar();
while(!isdigit(c)) { if(c == '-') f = -1; c = getchar(); }
while(isdigit(c)) { x = x * 10 + c - '0'; c = getchar(); }
return x * f;
}
const int N = 1e5 + 5;
int nr, nf, n;
double _r[N];
struct Vector {
double x, y;
double arc() { return atan2(y, x); }
friend bool operator <(Vector a, Vector b) { return a.arc() < b.arc(); }
friend double operator *(Vector a, Vector b) { return a.x * b.x + a.y * b.y; }
double len() { return sqrt(*this * *this); }
} _l[N];
double GetDis(Vector a, int id, double r) {
double alen = _l[id].len();
double x = _l[id].x * r / alen, y = _l[id].y * r / alen;
return sqrt((a.x - x) * (a.x - x) + (a.y - y) * (a.y - y));
}
double GetMin(Vector a, int id) {
double len = a * _l[id] / _l[id].len();
int nxt = lower_bound(_r + 1, _r + 1 + nr, len) - _r;
double ans = 1e18;
for(int i = -2; i <= 2; i++) if(nxt + i >= 1 && nxt + i <= nr)
ans = min(ans, GetDis(a, id, _r[nxt + i]));
return ans;
}
main() {
nr = get(), nf = get(), n = get();
for(int i = 1; i <= nr; i++) _r[i] = get();
for(int i = 1; i <= nf; i++) _l[i].x = get(), _l[i].y = get();
sort(_l + 1, _l + 1 + nf);
_l[0] = _l[nf], _l[nf + 1] = _l[1];
for(int i = 1; i <= n; i++) {
Vector now;
now.x = get(), now.y = get();
int suf = lower_bound(_l + 1, _l + 1 + nf, now) - _l;
double ans = 1e18;
for(int i = -2; i <= 2; i++)
ans = min(ans, GetMin(now, (suf + i + nf) % nf));
printf("%.10Lf\n", ans);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3612kb
input:
3 8 4 2 4 7 1 0 2 1 0 1 -1 1 -5 -2 -5 -6 -2 -7 6 -1 -1 -1 3 1 -5 -3 8 1
output:
0.6052910729 0.9777722905 1.5518451054 1.4142135624
result:
ok 4 numbers
Test #2:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
1 8 32 7 0 1 1 0 0 -1 -1 0 1 -1 -1 1 -1 -1 1 1 20 10 10 20 -20 10 10 -20 -10 20 20 -10 -10 -20 -20 -10 2 1 1 2 -2 1 1 -2 -1 2 2 -1 -1 -2 -2 -1 5 0 0 5 -5 0 0 -5 5 5 5 -5 -5 5 -5 -5 9 0 0 9 -9 0 0 -9 9 9 9 -9 -9 9 -9 -9
output:
15.8749850993 15.8749850993 15.8749850993 15.8749850993 15.8749850993 15.8749850993 15.8749850993 15.8749850993 4.9296567010 4.9296567010 4.9296567010 4.9296567010 4.9296567010 4.9296567010 4.9296567010 4.9296567010 2.0000000000 2.0000000000 2.0000000000 2.0000000000 0.0710678119 0.0710678119 0.0710...
result:
ok 32 numbers
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3712kb
input:
3 4 1681 16 8 4 -1 0 0 -1 0 1 1 0 -9 17 -4 -7 2 -13 -11 -17 15 -19 -7 1 -8 14 -8 -7 -8 20 -16 -3 12 14 -3 12 9 -5 -18 11 3 -1 2 0 -18 0 0 -19 -1 -19 18 -8 2 20 5 -8 -8 -19 -9 -16 20 -19 14 -1 3 10 -1 -4 4 10 16 17 19 -7 -17 4 1 -12 -5 -12 -5 -10 -15 -5 -10 -19 -2 -10 -4 -16 -2 4 -14 8 -17 16 4 1 16 ...
output:
12.7279220614 4.1231056256 5.3851648071 14.2126704036 18.6010752377 1.4142135624 10.0000000000 7.0000000000 14.4222051019 8.5440037453 13.4164078650 5.0000000000 5.0990195136 14.8660687473 1.4142135624 2.0000000000 10.0000000000 11.0000000000 11.0453610172 12.8062484749 12.1655250606 5.0000000000 13...
result:
wrong answer 1st numbers differ - expected: '9.0553851', found: '12.7279221', error = '0.4055639'