# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
465604 |
2021-08-16T14:04:34 Z |
tphuc2908 |
Mobile (BOI12_mobile) |
C++14 |
|
1000 ms |
48096 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;
double L;
pair<double, double> a[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;
vector<pair<double,double> > b;
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.pb(mp(val1, val));
}
sort(all(b));
double from = 0, to = L;
rep(i,0,(int)b.size()-1)
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 |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
320 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 |
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 |
320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
460 KB |
Output is correct |
2 |
Correct |
5 ms |
460 KB |
Output is correct |
3 |
Correct |
3 ms |
332 KB |
Output is correct |
4 |
Correct |
5 ms |
500 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
636 KB |
Output is correct |
2 |
Correct |
12 ms |
688 KB |
Output is correct |
3 |
Correct |
15 ms |
668 KB |
Output is correct |
4 |
Correct |
7 ms |
696 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
620 KB |
Output is correct |
2 |
Correct |
12 ms |
700 KB |
Output is correct |
3 |
Correct |
15 ms |
668 KB |
Output is correct |
4 |
Correct |
6 ms |
700 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
808 KB |
Output is correct |
2 |
Correct |
12 ms |
700 KB |
Output is correct |
3 |
Correct |
17 ms |
676 KB |
Output is correct |
4 |
Correct |
6 ms |
700 KB |
Output is correct |
5 |
Correct |
8 ms |
668 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
144 ms |
4908 KB |
Output is correct |
2 |
Correct |
325 ms |
6084 KB |
Output is correct |
3 |
Correct |
219 ms |
3640 KB |
Output is correct |
4 |
Correct |
101 ms |
5900 KB |
Output is correct |
5 |
Correct |
93 ms |
3312 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
146 ms |
4872 KB |
Output is correct |
2 |
Correct |
123 ms |
5404 KB |
Output is correct |
3 |
Correct |
129 ms |
5880 KB |
Output is correct |
4 |
Correct |
106 ms |
6072 KB |
Output is correct |
5 |
Correct |
95 ms |
6568 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
252 ms |
5384 KB |
Output is correct |
2 |
Correct |
364 ms |
5068 KB |
Output is correct |
3 |
Correct |
418 ms |
5156 KB |
Output is correct |
4 |
Correct |
72 ms |
7336 KB |
Output is correct |
5 |
Correct |
159 ms |
6112 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
356 ms |
5560 KB |
Output is correct |
2 |
Correct |
449 ms |
5616 KB |
Output is correct |
3 |
Correct |
529 ms |
5564 KB |
Output is correct |
4 |
Correct |
79 ms |
7372 KB |
Output is correct |
5 |
Correct |
155 ms |
6780 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
285 ms |
5548 KB |
Output is correct |
2 |
Correct |
448 ms |
5632 KB |
Output is correct |
3 |
Correct |
539 ms |
5516 KB |
Output is correct |
4 |
Correct |
76 ms |
7640 KB |
Output is correct |
5 |
Correct |
156 ms |
6788 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1090 ms |
24292 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1091 ms |
24340 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1088 ms |
35584 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1054 ms |
35612 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1088 ms |
38812 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1086 ms |
38812 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1087 ms |
41980 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1084 ms |
41872 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1096 ms |
48096 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1086 ms |
48084 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |