Submission #920903

# Submission time Handle Problem Language Result Execution time Memory
920903 2024-02-03T07:31:46 Z Kams7 Mobile (BOI12_mobile) C++17
8 / 100
763 ms 94376 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long

double dist(double k, ll y){
    return sqrt(k*k - y*y);
}

bool check(ll n, double k, ll l, vector<pair<ll,ll>> v){
    double mn = 0;
    for (ll i=0; i<n; i++){
        ll x = v[i].first, y = v[i].second;
        double d = dist(k, y);
        if (d<=0) continue;
        if (x-d<=mn) mn = max(mn, x+d);
    }
    return mn>=l;
}

void solve(){
    ll n, len; cin >> n >> len;
    map<ll, ll> ys; 
    for (ll i=0; i<n; i++){
        ll x, y; cin >> x >> y;
        if (ys.find(x) == ys.end()) ys[x] = abs(y);
        else ys[x] = min(ys[x], abs(y));
    }
    vector<pair<ll, ll>> v;
    for (auto el: ys){
        v.push_back(make_pair(el.first, el.second));
    }
    sort(v.begin(), v.end());
    n = size(v);
    double l=0, r=1.5e9;
    while (r-l>1e-4){
        double mid = ((l+r)/2);
        if (check(n, mid, len, v)) r=mid;
        else l=mid;
    }
    cout << l << "\n";
}


int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(NULL);
	// your code goes here
	// int t;
	// cin >> t;
	// while (t--) 
    solve();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Incorrect 1 ms 604 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 604 KB Output is correct
2 Incorrect 4 ms 860 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Output is correct
2 Incorrect 3 ms 860 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 860 KB Output is correct
2 Incorrect 3 ms 860 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 50 ms 6848 KB Output is correct
2 Incorrect 37 ms 5828 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 25 ms 852 KB Output is correct
2 Correct 41 ms 3780 KB Output is correct
3 Incorrect 45 ms 6836 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 59 ms 8640 KB Output is correct
2 Incorrect 38 ms 5320 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 43 ms 4392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 55 ms 10220 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 324 ms 47420 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 152 ms 1488 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 380 ms 58036 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 159 ms 1108 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 455 ms 66432 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 177 ms 852 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 570 ms 77556 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 218 ms 848 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 763 ms 94376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 261 ms 760 KB Output isn't correct
2 Halted 0 ms 0 KB -