# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
465619 |
2021-08-16T14:40:22 Z |
tphuc2908 |
Mobile (BOI12_mobile) |
C++14 |
|
1000 ms |
31600 KB |
#include<bits/stdc++.h>
using namespace std;
#define rep(i, x, y) for(int i = x; i <= y; ++i)
#define repi(i,x,y) for(int i = x; i >= y; --i)
#define ci(x) int x; cin>> x
#define TC(t) ci(t); while(t--)
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define cii(x, y) ci(x); ci(y)
#define mp make_pair
typedef long long ll;
typedef vector<int> vi;
const int N = 1e6 + 5;
const int mod = 1e9+7;
const int inf = 1e9 + 5;
void readfile(){
#ifdef ONLINE_JUDGE
#else
freopen("text.inp", "r", stdin);
#endif // ONLINE_JUDGE
// freopen("angry.in", "r", stdin);
// freopen("angry.out", "w", stdout);
}
int n, cnt = 0;
double L;
pair<double, double> a[N], b[N];
double pref[N];
void inp(){
cin >> n >> L;
rep(i,1,n){
cii(x, y);
a[i] = {double(x), double(y)};
}
}
bool check(double x){
x = x*x;
cnt = 0;
rep(i,1,n){
if(a[i].se > x) continue;
double temp = sqrt(x - a[i].se);
double val = a[i].fi + temp;
double val1 = a[i].fi - temp;
b[++cnt] = mp(val1, val);
}
sort(b + 1, b + cnt + 1);
double from = 0, to = L;
rep(i,1,cnt)
if(b[i].fi <= from && from <= b[i].se)
from = b[i].se;
return from >= to;
}
double res;
void process(){
rep(i,1,n)
a[i].se = a[i].se*a[i].se;
double l = 0, r = 1e9;
rep(i,1,50){
double mid = (l + r) / 2;
if(check(mid)){
res = mid;
r = mid;
}
else l = mid;
}
cout << fixed << setprecision(6) << res;
}
int main(){
//readfile();
ios_base::sync_with_stdio(0);
cin.tie(0);
inp();
process();
return 0;
}
Compilation message
mobile.cpp: In function 'void readfile()':
mobile.cpp:23:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
23 | freopen("text.inp", "r", stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
332 KB |
Output is correct |
2 |
Correct |
4 ms |
332 KB |
Output is correct |
3 |
Correct |
3 ms |
332 KB |
Output is correct |
4 |
Correct |
3 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
496 KB |
Output is correct |
2 |
Correct |
7 ms |
460 KB |
Output is correct |
3 |
Correct |
12 ms |
496 KB |
Output is correct |
4 |
Correct |
5 ms |
492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
496 KB |
Output is correct |
2 |
Correct |
8 ms |
460 KB |
Output is correct |
3 |
Correct |
12 ms |
460 KB |
Output is correct |
4 |
Correct |
6 ms |
500 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
496 KB |
Output is correct |
2 |
Correct |
7 ms |
460 KB |
Output is correct |
3 |
Correct |
14 ms |
500 KB |
Output is correct |
4 |
Correct |
6 ms |
460 KB |
Output is correct |
5 |
Correct |
6 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
102 ms |
2688 KB |
Output is correct |
2 |
Correct |
221 ms |
2716 KB |
Output is correct |
3 |
Correct |
152 ms |
1904 KB |
Output is correct |
4 |
Correct |
82 ms |
2632 KB |
Output is correct |
5 |
Correct |
70 ms |
1880 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
112 ms |
2760 KB |
Output is correct |
2 |
Correct |
90 ms |
2508 KB |
Output is correct |
3 |
Correct |
100 ms |
2852 KB |
Output is correct |
4 |
Correct |
88 ms |
2780 KB |
Output is correct |
5 |
Correct |
91 ms |
3084 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
138 ms |
3068 KB |
Output is correct |
2 |
Correct |
253 ms |
2892 KB |
Output is correct |
3 |
Correct |
370 ms |
3012 KB |
Output is correct |
4 |
Correct |
63 ms |
3428 KB |
Output is correct |
5 |
Correct |
119 ms |
3104 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
235 ms |
3448 KB |
Output is correct |
2 |
Correct |
336 ms |
3452 KB |
Output is correct |
3 |
Correct |
432 ms |
3404 KB |
Output is correct |
4 |
Correct |
66 ms |
3340 KB |
Output is correct |
5 |
Correct |
134 ms |
3372 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
152 ms |
3448 KB |
Output is correct |
2 |
Correct |
347 ms |
3452 KB |
Output is correct |
3 |
Correct |
430 ms |
3452 KB |
Output is correct |
4 |
Correct |
66 ms |
3432 KB |
Output is correct |
5 |
Correct |
125 ms |
3452 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
968 ms |
15968 KB |
Output is correct |
2 |
Execution timed out |
1082 ms |
17600 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1081 ms |
15868 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1006 ms |
19108 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1089 ms |
19012 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1093 ms |
22180 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1092 ms |
22212 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1092 ms |
25236 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1085 ms |
25540 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1088 ms |
31600 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1079 ms |
31524 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |