QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#187413 | #3854. Radar | ballance# | WA | 1ms | 3808kb | C++17 | 1.8kb | 2023-09-24 17:05:28 | 2023-09-24 17:05:28 |
Judging History
answer
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<cmath>
using namespace std;
typedef long long ll;
typedef long double ld;
const ld PI = 2*acos(ld(0));
ld angle(ld x, ld y)
{
if (x == 0)
{
if (y > 0)
return PI / 2;
return -PI / 2;
}
if (x > 0)
return atan(ld(y) / x);
else
if (y < 0)return -PI + atan(ld(y) / x);
else
return PI + atan(ld(y) / x);
}
ld len(ld x, ld y)
{
return sqrt(x * x + y * y);
}
const int N = 100010;
int r[N];
ld a[N];
ld len2(ld alpha, ld r, ld x, ld y)
{
ld dx = r * cos(alpha), dy = r * sin(alpha);
return len(dx - x, dy - y);
}
signed main()
{
cout << PI;
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int rr, ff, tt;
cin >> rr >> ff >> tt;
for (int i = 1; i <= rr; i++)
cin >> r[i];
sort(r + 1, r + rr + 1);
r[0] = -1e8;
r[rr + 1] = 1e8;
for (int i = 1; i <= ff; i++)
{
int x, y; cin >> x >> y;
a[i] = angle(x, y);
//cout << x << ' ' << y << ' ' << a[i] << '\n';
}
sort(a + 1, a + ff + 1);
a[ff + 1] = a[1] + 2 * PI;
a[0] = a[ff] - 2 * PI;
while (tt--)
{
int x, y; cin >> x >> y;
ld leng = len(x, y);
/*int l = lower_bound(r, r + rr + 2, leng) - r;
int s[3];
s[1] = r[l - 1], s[2] = r[l];*/
ld alpha = angle(x, y);
int l = lower_bound(a + 1, a + ff + 2, alpha) - a;
ld p[3];
p[1] = a[l - 1], p[2] = a[l];
ld ans = 1e10;
for (int i = 1; i <= 2; i++)
{
ld beta = p[i];
ld shadowlen = leng * cos(beta - alpha);
int l = lower_bound(r, r + rr + 2, shadowlen) - r;
int s[3];
s[1] = r[l - 1], s[2] = r[l];
for (int j = 1; j <= 2; j++)
ans = min(ans, len2(beta, s[j], x, y));
}
if (ans < 1e-7)
ans = 0;
cout << fixed << setprecision(15) << ans << '\n';
}
}
/*
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3808kb
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:
3.141590.605291072916640 0.977772290465605 1.551845105401790 1.414213562373095
result:
wrong output format Expected double, but "3.141590.605291072916640" found