Submission #920892

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

double dist(double k, ll y){
    if (k<y) return -1;
    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==-1) 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 348 KB Output is correct
2 Correct 1 ms 452 KB Output is correct
3 Correct 1 ms 460 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 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 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 348 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 856 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 600 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 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 47 ms 7368 KB Output is correct
2 Incorrect 38 ms 6504 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 18 ms 1624 KB Output is correct
2 Correct 30 ms 4280 KB Output is correct
3 Incorrect 39 ms 7620 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 47 ms 9440 KB Output is correct
2 Incorrect 39 ms 6228 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 43 ms 5832 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 70 ms 11204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 315 ms 49948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 139 ms 5960 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 377 ms 60840 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 163 ms 6480 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 449 ms 70872 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 187 ms 6996 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 527 ms 80380 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 214 ms 8292 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 667 ms 99148 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 246 ms 9416 KB Output isn't correct
2 Halted 0 ms 0 KB -