# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
465626 |
2021-08-16T14:57:39 Z |
tphuc2908 |
Mobile (BOI12_mobile) |
C++14 |
|
484 ms |
35132 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 cur = 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;
if(val1 <= cur)
cur = max(cur, val);
}
return cur >= L;
}
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 |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
316 KB |
Output is correct |
4 |
Correct |
1 ms |
316 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 |
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 |
2 ms |
332 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 |
3 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
460 KB |
Output is correct |
2 |
Correct |
2 ms |
460 KB |
Output is correct |
3 |
Correct |
2 ms |
332 KB |
Output is correct |
4 |
Correct |
3 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
456 KB |
Output is correct |
2 |
Correct |
3 ms |
460 KB |
Output is correct |
3 |
Correct |
2 ms |
332 KB |
Output is correct |
4 |
Correct |
3 ms |
460 KB |
Output is correct |
5 |
Correct |
2 ms |
452 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
2252 KB |
Output is correct |
2 |
Correct |
32 ms |
2508 KB |
Output is correct |
3 |
Correct |
20 ms |
1740 KB |
Output is correct |
4 |
Correct |
27 ms |
2528 KB |
Output is correct |
5 |
Correct |
17 ms |
1504 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
2292 KB |
Output is correct |
2 |
Correct |
25 ms |
2168 KB |
Output is correct |
3 |
Correct |
30 ms |
2608 KB |
Output is correct |
4 |
Correct |
28 ms |
2496 KB |
Output is correct |
5 |
Correct |
32 ms |
2684 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
35 ms |
2280 KB |
Output is correct |
2 |
Correct |
38 ms |
2704 KB |
Output is correct |
3 |
Correct |
32 ms |
2540 KB |
Output is correct |
4 |
Correct |
39 ms |
2844 KB |
Output is correct |
5 |
Correct |
31 ms |
2628 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
42 ms |
2884 KB |
Output is correct |
2 |
Correct |
42 ms |
2896 KB |
Output is correct |
3 |
Correct |
37 ms |
2900 KB |
Output is correct |
4 |
Correct |
38 ms |
2848 KB |
Output is correct |
5 |
Correct |
34 ms |
2864 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
2844 KB |
Output is correct |
2 |
Correct |
48 ms |
2812 KB |
Output is correct |
3 |
Correct |
37 ms |
2892 KB |
Output is correct |
4 |
Correct |
43 ms |
2900 KB |
Output is correct |
5 |
Correct |
35 ms |
2892 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
203 ms |
10092 KB |
Output is correct |
2 |
Correct |
213 ms |
10188 KB |
Output is correct |
3 |
Correct |
213 ms |
15368 KB |
Output is correct |
4 |
Correct |
183 ms |
17608 KB |
Output is correct |
5 |
Correct |
175 ms |
14856 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
213 ms |
10128 KB |
Output is correct |
2 |
Correct |
249 ms |
14824 KB |
Output is correct |
3 |
Correct |
185 ms |
13884 KB |
Output is correct |
4 |
Correct |
196 ms |
17460 KB |
Output is correct |
5 |
Correct |
180 ms |
15428 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
227 ms |
11716 KB |
Output is correct |
2 |
Correct |
254 ms |
12356 KB |
Output is correct |
3 |
Correct |
252 ms |
18400 KB |
Output is correct |
4 |
Correct |
226 ms |
21576 KB |
Output is correct |
5 |
Correct |
214 ms |
17604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
252 ms |
11692 KB |
Output is correct |
2 |
Correct |
295 ms |
17616 KB |
Output is correct |
3 |
Correct |
222 ms |
16652 KB |
Output is correct |
4 |
Correct |
230 ms |
21308 KB |
Output is correct |
5 |
Correct |
214 ms |
18372 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
265 ms |
13252 KB |
Output is correct |
2 |
Correct |
300 ms |
13988 KB |
Output is correct |
3 |
Correct |
302 ms |
21416 KB |
Output is correct |
4 |
Correct |
281 ms |
24788 KB |
Output is correct |
5 |
Correct |
277 ms |
20288 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
304 ms |
13608 KB |
Output is correct |
2 |
Correct |
331 ms |
20420 KB |
Output is correct |
3 |
Correct |
282 ms |
19744 KB |
Output is correct |
4 |
Correct |
262 ms |
24632 KB |
Output is correct |
5 |
Correct |
258 ms |
21304 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
301 ms |
15044 KB |
Output is correct |
2 |
Correct |
346 ms |
15720 KB |
Output is correct |
3 |
Correct |
340 ms |
24388 KB |
Output is correct |
4 |
Correct |
307 ms |
28484 KB |
Output is correct |
5 |
Correct |
299 ms |
24004 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
346 ms |
15440 KB |
Output is correct |
2 |
Correct |
394 ms |
23384 KB |
Output is correct |
3 |
Correct |
307 ms |
22408 KB |
Output is correct |
4 |
Correct |
338 ms |
28280 KB |
Output is correct |
5 |
Correct |
293 ms |
24336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
402 ms |
18788 KB |
Output is correct |
2 |
Correct |
456 ms |
18904 KB |
Output is correct |
3 |
Correct |
421 ms |
30496 KB |
Output is correct |
4 |
Correct |
379 ms |
35132 KB |
Output is correct |
5 |
Correct |
359 ms |
29512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
484 ms |
15936 KB |
Output is correct |
2 |
Correct |
469 ms |
29252 KB |
Output is correct |
3 |
Correct |
391 ms |
28228 KB |
Output is correct |
4 |
Correct |
376 ms |
34296 KB |
Output is correct |
5 |
Correct |
359 ms |
30688 KB |
Output is correct |