# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
655453 |
2022-11-04T13:01:38 Z |
bLIC |
Mobile (BOI12_mobile) |
C++17 |
|
1000 ms |
81096 KB |
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)(x).size()
#define ft first
#define sd second
#define pb push_back
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;
typedef vector<vi> vvi;
#define dbg if(1)
template <class _T>
string printbit(_T x) {string s="";while(x){s=((x%2)?'1':'0')+s;x/=2;} return s;}
template <class _T>
string printbit(_T x, int len) {string s="";while(len--){s=((x%2)?'1':'0')+s;x/=2;} return s;}
const int MOD = 1e9+7;
const int INF = 1e9;
const int maxN = 1e6+5;
ll n;
long double l;
vector<pair<long double, long double>> cor(maxN);
bool check(long double mid){
vector<pair<long double, long double>> coord;
for (int i =0;i<n;i++){
auto p = cor[i];
auto power = mid;
if (p.second-power>-1e-4) continue;
else {
long double len = sqrt(power*power - p.sd*p.sd);
coord.pb(make_pair(p.ft-len, p.ft+len));
}
}
sort(all(coord));
if (coord.empty() || coord[0].ft>1e-5) return false;
long double curr = 0;
for (auto x:coord){
if (x.ft-curr>-1e-4) return false;
curr = max(curr, x.sd);
if (curr-l>-1e-4) return true;
}
return curr-l>-1e-4;
}
void solve(){
// cout<<sizeof(l);
// return;
cin>>n>>l;
for (int i = 0;i<n;i++) cin>>cor[i].ft>>cor[i].sd;
long double l = 0, r = 1e10;
while(r-l>1e-4){
long double mid = (l+r)/2;
if (check(mid)) r = mid;
else l = mid;
}
cout<<fixed<<setprecision(6)<<r;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t = 1;
// cin>>t;
while(t--){
solve();
cout<<endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
31572 KB |
Output is correct |
2 |
Correct |
27 ms |
31592 KB |
Output is correct |
3 |
Correct |
25 ms |
31568 KB |
Output is correct |
4 |
Correct |
25 ms |
31640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
25 ms |
31592 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
36 ms |
31872 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
48 ms |
32112 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
51 ms |
32116 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
45 ms |
32064 KB |
Output is correct |
2 |
Correct |
53 ms |
32044 KB |
Output is correct |
3 |
Correct |
53 ms |
32060 KB |
Output is correct |
4 |
Incorrect |
51 ms |
32036 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
289 ms |
38208 KB |
Output is correct |
2 |
Correct |
512 ms |
38200 KB |
Output is correct |
3 |
Correct |
330 ms |
35424 KB |
Output is correct |
4 |
Incorrect |
515 ms |
38132 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
527 ms |
38236 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
457 ms |
38640 KB |
Output is correct |
2 |
Correct |
554 ms |
38364 KB |
Output is correct |
3 |
Correct |
713 ms |
38440 KB |
Output is correct |
4 |
Incorrect |
715 ms |
38876 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
597 ms |
38928 KB |
Output is correct |
2 |
Correct |
709 ms |
39096 KB |
Output is correct |
3 |
Correct |
856 ms |
38932 KB |
Output is correct |
4 |
Incorrect |
652 ms |
38860 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
499 ms |
38916 KB |
Output is correct |
2 |
Correct |
713 ms |
38928 KB |
Output is correct |
3 |
Correct |
865 ms |
38920 KB |
Output is correct |
4 |
Incorrect |
781 ms |
38852 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1097 ms |
63872 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1094 ms |
63796 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1091 ms |
80988 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1093 ms |
81000 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1080 ms |
81096 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1089 ms |
80972 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1086 ms |
81020 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1091 ms |
80872 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1088 ms |
80932 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1092 ms |
80872 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |