QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#880763 | #3854. Radar | ychangseok | Compile Error | / | / | C++17 | 3.0kb | 2025-02-03 19:48:15 | 2025-02-03 19:48:15 |
Judging History
This is the latest submission verdict.
- [2025-02-03 19:48:15]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2025-02-03 19:48:15]
- Submitted
answer
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef long double lb;
#define all(v) v.begin(), v.end()
#define M_PI 3.14159265358979323846
#define EPS 1e-6
lb getdist(ll x, ll y, ll r, lb a){
// cout << r * cos(a) << ' ' << r * sin(a) << ' ';
a *= M_PI / 180;
lb dx = x - r * cos(a);
lb dy = y - r * sin(a);
return dx*dx + dy*dy;
}
ll n, m, q;
ll x, y, r;
vector<ll> vr;
vector<lb> angle;
int main(){
cin.tie(0)->sync_with_stdio(0);
cout << fixed;
cout.precision(12);
cin >> n >> m >> q;
for (int i = 1; i <= n; i++){
cin >> r;
vr.push_back(r);
}
for (int i = 1; i <= m; i++){
cin >> x >> y;
angle.push_back(atan2(y,x) * 180 / M_PI);
}
sort(all(vr));
sort(all(angle));
vector<lb> tmp;
for (int i = 0; i < m; i++){
tmp.push_back(angle[i] - 360);
}
for (int i = 0; i < m; i++){
tmp.push_back(angle[i]);
}
for (int i = 0; i < m; i++){
tmp.push_back(angle[i] + 360);
}
// for (int i = 0; i < n; i++){
// cout << vr[i] << ' ';
// }
// cout << endl;
// for (int i = 0; i < m; i++){
// cout << angle[i] * 180 / M_PI << endl;
// // if (i % m == m-1) cout << endl;
// }
// cout << endl;
// for (int i = 0; i < 3*m; i++){
// cout << tmp[i] * 180 / M_PI << endl;
// if (i % m == m-1) cout << endl;
// }
// cout << endl;
// cout << endl;
while (q--){
cin >> x >> y;
int left = 0;
int right = n - 1;
while (left < right){
int mid = (left + right + 1) / 2;
if (x*x+y*y >= vr[mid]*vr[mid]){
left = mid;
}else{
right = mid - 1;
}
}
// cout << x << ' ' << y << ' ' << vr[left] << '\n';
int lr = left;
lb theta = atan2(y, x) * 180 / M_PI;
int lt = 0;
left = 0;
right = 3*m - 1;
while (left+1 < right){
int mid = (left + right + 1) / 2;
if (tmp[mid] > theta + EPS) right = mid - 1;
else if (tmp[mid] <left = mid;
}
// cout << angle[left].deg << ' ' << theta << ' ' << angle[right].deg << endl;
lt = left;
// cout << lt << ' ' << rt << endl;
lb dist = 9e18;
for (int ridx = lr-5; ridx <= lr+5; ridx++){
if (ridx < 0) continue;
if (ridx >= n) continue;
for (int tidx = lt-5; tidx <= lt+5; tidx++){
if (tidx < 0) continue;
lb d = getdist(x, y, vr[ridx], angle[(tidx)%m]);
// cout << d << endl;
dist = min(dist, d);
}
}
cout << sqrt(dist) << '\n';
// cout << endl;
}
}
Details
answer.code: In function ‘int main()’: answer.code:107:31: error: lvalue required as left operand of assignment 107 | else if (tmp[mid] <left = mid; answer.code:108:9: error: expected primary-expression before ‘}’ token 108 | } | ^ answer.code:107:43: error: expected ‘)’ before ‘}’ token 107 | else if (tmp[mid] <left = mid; | ~ ^ | ) 108 | } | ~ answer.code:108:9: error: expected primary-expression before ‘}’ token 108 | } | ^