# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
465628 |
2021-08-16T14:59:36 Z |
tphuc2908 |
Mobile (BOI12_mobile) |
C++14 |
|
475 ms |
16960 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;
double from = 0, to = L;
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;
if(val1 <= from && from <= val)
from = val;
}
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 |
1 ms |
316 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
216 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 |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
2 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
2 ms |
356 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
3 ms |
460 KB |
Output is correct |
3 |
Correct |
2 ms |
332 KB |
Output is correct |
4 |
Correct |
2 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
3 ms |
460 KB |
Output is correct |
3 |
Correct |
2 ms |
332 KB |
Output is correct |
4 |
Correct |
2 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
460 KB |
Output is correct |
2 |
Correct |
3 ms |
460 KB |
Output is correct |
3 |
Correct |
3 ms |
332 KB |
Output is correct |
4 |
Correct |
2 ms |
460 KB |
Output is correct |
5 |
Correct |
2 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
2308 KB |
Output is correct |
2 |
Correct |
38 ms |
2580 KB |
Output is correct |
3 |
Correct |
21 ms |
1704 KB |
Output is correct |
4 |
Correct |
27 ms |
2648 KB |
Output is correct |
5 |
Correct |
16 ms |
1504 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
2252 KB |
Output is correct |
2 |
Correct |
24 ms |
2212 KB |
Output is correct |
3 |
Correct |
27 ms |
2508 KB |
Output is correct |
4 |
Correct |
28 ms |
2764 KB |
Output is correct |
5 |
Correct |
33 ms |
3132 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
33 ms |
2328 KB |
Output is correct |
2 |
Correct |
35 ms |
2748 KB |
Output is correct |
3 |
Correct |
32 ms |
2620 KB |
Output is correct |
4 |
Correct |
36 ms |
3844 KB |
Output is correct |
5 |
Correct |
30 ms |
2636 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
45 ms |
3396 KB |
Output is correct |
2 |
Correct |
45 ms |
3216 KB |
Output is correct |
3 |
Correct |
39 ms |
2852 KB |
Output is correct |
4 |
Correct |
35 ms |
3776 KB |
Output is correct |
5 |
Correct |
34 ms |
3028 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
48 ms |
3388 KB |
Output is correct |
2 |
Correct |
43 ms |
3284 KB |
Output is correct |
3 |
Correct |
37 ms |
2920 KB |
Output is correct |
4 |
Correct |
35 ms |
3788 KB |
Output is correct |
5 |
Correct |
34 ms |
3096 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
194 ms |
10236 KB |
Output is correct |
2 |
Correct |
219 ms |
9940 KB |
Output is correct |
3 |
Correct |
246 ms |
9512 KB |
Output is correct |
4 |
Correct |
171 ms |
9416 KB |
Output is correct |
5 |
Correct |
172 ms |
9420 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
223 ms |
10440 KB |
Output is correct |
2 |
Correct |
248 ms |
9384 KB |
Output is correct |
3 |
Correct |
190 ms |
9488 KB |
Output is correct |
4 |
Correct |
170 ms |
9388 KB |
Output is correct |
5 |
Correct |
166 ms |
9420 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
240 ms |
11960 KB |
Output is correct |
2 |
Correct |
258 ms |
11248 KB |
Output is correct |
3 |
Correct |
261 ms |
10988 KB |
Output is correct |
4 |
Correct |
212 ms |
11176 KB |
Output is correct |
5 |
Correct |
207 ms |
10992 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
255 ms |
11888 KB |
Output is correct |
2 |
Correct |
295 ms |
10912 KB |
Output is correct |
3 |
Correct |
233 ms |
10996 KB |
Output is correct |
4 |
Correct |
210 ms |
11076 KB |
Output is correct |
5 |
Correct |
203 ms |
10984 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
278 ms |
13480 KB |
Output is correct |
2 |
Correct |
302 ms |
12808 KB |
Output is correct |
3 |
Correct |
291 ms |
12444 KB |
Output is correct |
4 |
Correct |
250 ms |
12436 KB |
Output is correct |
5 |
Correct |
237 ms |
12324 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
306 ms |
13184 KB |
Output is correct |
2 |
Correct |
339 ms |
12424 KB |
Output is correct |
3 |
Correct |
271 ms |
12424 KB |
Output is correct |
4 |
Correct |
245 ms |
12312 KB |
Output is correct |
5 |
Correct |
233 ms |
12332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
314 ms |
14616 KB |
Output is correct |
2 |
Correct |
339 ms |
14024 KB |
Output is correct |
3 |
Correct |
339 ms |
13740 KB |
Output is correct |
4 |
Correct |
281 ms |
13980 KB |
Output is correct |
5 |
Correct |
271 ms |
13780 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
341 ms |
14316 KB |
Output is correct |
2 |
Correct |
380 ms |
13896 KB |
Output is correct |
3 |
Correct |
306 ms |
13792 KB |
Output is correct |
4 |
Correct |
282 ms |
13652 KB |
Output is correct |
5 |
Correct |
282 ms |
13552 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
388 ms |
16960 KB |
Output is correct |
2 |
Correct |
440 ms |
16840 KB |
Output is correct |
3 |
Correct |
424 ms |
16708 KB |
Output is correct |
4 |
Correct |
354 ms |
15984 KB |
Output is correct |
5 |
Correct |
340 ms |
16500 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
429 ms |
16024 KB |
Output is correct |
2 |
Correct |
475 ms |
16436 KB |
Output is correct |
3 |
Correct |
391 ms |
16352 KB |
Output is correct |
4 |
Correct |
362 ms |
16736 KB |
Output is correct |
5 |
Correct |
353 ms |
16208 KB |
Output is correct |