#include <bits/stdc++.h>
// #pragma GCC optimize("Ofast,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
using namespace std;
/*
chutar resposta x:
p toda torre achar achar menor e maior ponto com distância menor que x
se intervalo tem algum ponto cego: x é válido
se não, nn é
achar pontos p torre: busca binária
*/
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); // overclock random
typedef pair<int,int> pii;
typedef pair<long long, long long> pll;
typedef pair<long double, long double> pdd;
const int MAXN = 1e6+10;
const double PRECISION = 1e-5;
long double dist(pdd a, pdd b){
long double x = abs(a.first-b.first), y = abs(a.second-b.second);
return x*x + y*y;
}
pii p[MAXN];
int l;
long double right(int t, long double d){
long double sq = d*d;
if (p[t].first > l) return l * (dist(p[t], {l,0}) <= sq);
long double in=max(0, p[t].first), fi = l, me;
if (dist({in,0}, p[t]) > sq) return -1;
if (dist({l, 0}, p[t]) <= sq) return l;
for (int q=0;q<100;q++){
me = (in+fi)/2.00;
if (dist({me, 0}, p[t]) <= sq){
in = me;
}else fi = me;
}
return in;
}
signed main(){
std::ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
// freopen("test.in", "r", stdin);
// freopen("test.out", "w", stdout);
cout << fixed << setprecision(6);
int n;
cin >> n >> l;
for (int i=0;i<n;i++){
cin >> p[i].first >> p[i].second;
}
long double in=0, fi = 2e9, me;
for (int q=0;q<100;q++){
me = (in+fi)/2.00;
long double r=0;
bool vl = 1;
for (int i=0;i<n;i++){
if (dist(p[i], {r, 0}) <= me*me){
vl=0;
r = right(i, me);
}
}
vl = vl || (l!=r);
if (vl) in=me;
else fi=me;
}
cout << in << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
7 ms |
460 KB |
Output is correct |
4 |
Correct |
5 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
344 KB |
Output is correct |
2 |
Correct |
276 ms |
464 KB |
Output is correct |
3 |
Correct |
3 ms |
348 KB |
Output is correct |
4 |
Correct |
112 ms |
456 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
344 KB |
Output is correct |
2 |
Correct |
4 ms |
348 KB |
Output is correct |
3 |
Correct |
3 ms |
348 KB |
Output is correct |
4 |
Correct |
10 ms |
432 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
348 KB |
Output is correct |
2 |
Correct |
4 ms |
348 KB |
Output is correct |
3 |
Correct |
3 ms |
348 KB |
Output is correct |
4 |
Correct |
8 ms |
508 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
129 ms |
484 KB |
Output is correct |
2 |
Correct |
7 ms |
348 KB |
Output is correct |
3 |
Correct |
3 ms |
348 KB |
Output is correct |
4 |
Correct |
6 ms |
512 KB |
Output is correct |
5 |
Correct |
8 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
705 ms |
2648 KB |
Output is correct |
2 |
Correct |
60 ms |
2652 KB |
Output is correct |
3 |
Correct |
233 ms |
2652 KB |
Output is correct |
4 |
Correct |
43 ms |
2648 KB |
Output is correct |
5 |
Correct |
43 ms |
2652 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
56 ms |
2648 KB |
Output is correct |
2 |
Correct |
61 ms |
2652 KB |
Output is correct |
3 |
Correct |
59 ms |
2648 KB |
Output is correct |
4 |
Correct |
49 ms |
2648 KB |
Output is correct |
5 |
Correct |
58 ms |
2672 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1039 ms |
2652 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
68 ms |
2652 KB |
Output is correct |
2 |
Correct |
74 ms |
2648 KB |
Output is correct |
3 |
Correct |
74 ms |
2652 KB |
Output is correct |
4 |
Correct |
68 ms |
2648 KB |
Output is correct |
5 |
Correct |
60 ms |
2648 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1070 ms |
2652 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1063 ms |
4700 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
351 ms |
4692 KB |
Output is correct |
2 |
Execution timed out |
1076 ms |
4692 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1058 ms |
6740 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
436 ms |
6784 KB |
Output is correct |
2 |
Execution timed out |
1063 ms |
6740 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1067 ms |
6740 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
306 ms |
6736 KB |
Output is correct |
2 |
Execution timed out |
1014 ms |
6736 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1028 ms |
6744 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
569 ms |
6736 KB |
Output is correct |
2 |
Execution timed out |
1032 ms |
6740 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1063 ms |
8064 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
409 ms |
8060 KB |
Output is correct |
2 |
Execution timed out |
1018 ms |
8020 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |