# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1057324 |
2024-08-13T17:18:01 Z |
lucascgar |
Mobile (BOI12_mobile) |
C++17 |
|
1000 ms |
23116 KB |
#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-8;
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;
double right(int t, 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;
while (fi-in>=PRECISION){
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;
while (fi-in >= PRECISION){
me = (in+fi)/2.00;
long double r=0;
bool vl = 0;
for (int i=0;i<n;i++){
if (dist(p[i], {r, 0}) <= me*me){
r = right(i, me);
}
}
vl = vl || (l!=r);
if (vl) in=me;
else fi=me;
}
cout << in << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
472 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
468 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Output is correct |
2 |
Correct |
50 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
34 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
4 ms |
548 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
348 KB |
Output is correct |
2 |
Correct |
4 ms |
480 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
3 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
344 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
3 ms |
556 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
227 ms |
3468 KB |
Output is correct |
2 |
Correct |
34 ms |
3676 KB |
Output is correct |
3 |
Correct |
69 ms |
3160 KB |
Output is correct |
4 |
Correct |
27 ms |
3676 KB |
Output is correct |
5 |
Correct |
22 ms |
2904 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
3672 KB |
Output is correct |
2 |
Correct |
31 ms |
3420 KB |
Output is correct |
3 |
Correct |
30 ms |
3672 KB |
Output is correct |
4 |
Correct |
30 ms |
3672 KB |
Output is correct |
5 |
Correct |
33 ms |
4144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1035 ms |
3160 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
33 ms |
4188 KB |
Output is correct |
2 |
Correct |
41 ms |
3932 KB |
Output is correct |
3 |
Correct |
45 ms |
3676 KB |
Output is correct |
4 |
Correct |
38 ms |
4444 KB |
Output is correct |
5 |
Correct |
37 ms |
3700 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1078 ms |
4184 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1012 ms |
8784 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
193 ms |
12164 KB |
Output is correct |
2 |
Execution timed out |
1076 ms |
11100 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1042 ms |
11856 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
202 ms |
15696 KB |
Output is correct |
2 |
Execution timed out |
1051 ms |
14576 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1035 ms |
12256 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
285 ms |
17252 KB |
Output is correct |
2 |
Execution timed out |
1057 ms |
15956 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1030 ms |
13396 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
292 ms |
18772 KB |
Output is correct |
2 |
Execution timed out |
1085 ms |
17232 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1030 ms |
15952 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
313 ms |
23116 KB |
Output is correct |
2 |
Execution timed out |
1012 ms |
21360 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |