# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1055461 |
2024-08-12T19:45:14 Z |
lucascgar |
Mobile (BOI12_mobile) |
C++17 |
|
1000 ms |
24660 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<double, 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 left(int t, double d){
if (p[t].first < 0) return 0;
double in=0, fi = min(l,p[t].first), me;
long double sq=d*d;
if (dist({fi, 0}, p[t]) > sq) return -1;
if (dist({0, 0}, p[t]) <= sq) return 0;
while (fi-in>=PRECISION/10){
me = (in+fi)/2.00;
if (dist({me,0}, p[t]) <= sq){
fi = me;
}else in = me;
}
return fi;
}
double right(int t, double d){
if (p[t].first > l) return l;
double in=max(0, p[t].first), fi = l, me;
long double sq = d*d;
if (dist({in,0}, p[t]) > sq) return -1;
if (dist({l, 0}, p[t]) <= sq) return l;
while (fi-in>=PRECISION/10){
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;
}
double in=0, fi = 3e9, me;
while (fi-in >= PRECISION){
me = (in+fi)/2.00;
set<pdd> cv;
for (int i=0;i<n;i++){
double lf = left(i, me), rg = right(i, me);
if (lf != -1 && rg != -1) cv.emplace(lf, rg);
}
double r=0;
bool vl = 0;
for (const pdd &x:cv){
if (x.first > r && x.first-r > PRECISION){
vl=1;
break;
}
r = max(r, x.second);
}
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 |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
4 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
604 KB |
Output is correct |
2 |
Incorrect |
22 ms |
600 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
604 KB |
Output is correct |
2 |
Correct |
155 ms |
856 KB |
Output is correct |
3 |
Correct |
94 ms |
604 KB |
Output is correct |
4 |
Correct |
11 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
604 KB |
Output is correct |
2 |
Correct |
151 ms |
864 KB |
Output is correct |
3 |
Correct |
88 ms |
600 KB |
Output is correct |
4 |
Correct |
11 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
856 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
309 ms |
5208 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
136 ms |
4380 KB |
Output is correct |
2 |
Correct |
135 ms |
3868 KB |
Output is correct |
3 |
Correct |
153 ms |
5200 KB |
Output is correct |
4 |
Correct |
164 ms |
5460 KB |
Output is correct |
5 |
Execution timed out |
1060 ms |
2396 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1060 ms |
7508 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1092 ms |
2648 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1040 ms |
2648 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1018 ms |
8524 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1059 ms |
12372 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1060 ms |
10064 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1062 ms |
14932 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1058 ms |
11860 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1059 ms |
17256 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1072 ms |
13656 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1060 ms |
19796 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1061 ms |
16980 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1022 ms |
24660 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |