이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <queue>
#include <stack>
#include <algorithm>
#include <string.h>
#include <functional>
#include <iomanip>
#define task "task"
#define size() size() * 1ll
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define pii pair<int, int>
#define fi first
#define se second
#define MASK(x) (1LL << (x))
#define BIT(x,i) (((x) >> (i)) & 1)
#define numbit(x) __builtin_popcountll(x)
using namespace std;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef long long ll;
template<class t>
bool mini(t &x,t y) {
if (y < x) {
x = y;
return 1;
}
return 0;
}
template<class t>
bool maxi(t &x,t y) {
if (x < y) {
x = y;
return 1;
}
return 0;
}
const int N = 1e6 + 1;
const int M = 1e3 + 1;
const long long mod = 1e9 + 7;
const long long oo = 1e18 + 7;
void solve(int test = -1) {
int n, m;
cin >> n >> m;
pii a[n];
for (int i = 0; i < n; i++) {
cin >> a[i].fi >> a[i].se;
}
double l = 0, r = m;
int t = 1000;
long double ans = 0;
while (t--) {
double midl = (2 * l + r) / 3;
double midr = (l + 2 * r) / 3;
long double lef = 1e9;
for (int i = 0; i < n; i++) {
mini(lef, __builtin_sqrtl((long double)abs(midl - a[i].fi) * abs(midl - a[i].fi) + (long double)1.0 * a[i].se * a[i].se));
}
long double rig = 1e9;
for (int i = 0; i < n; i++) {
mini(rig, __builtin_sqrtl((long double)abs(midr - a[i].fi) * abs(midr - a[i].fi) + (long double)1.0 * a[i].se * a[i].se));
}
if (lef < rig) {
l = midl;
maxi(ans, lef);
} else {
maxi(ans, rig);
r = midr;
}
}
long double tmp = 1e9;
double mid = (l + r) / 2;
for (int i = 0; i < n; i++) {
mini(tmp, __builtin_sqrtl((long double)abs(mid - a[i].fi) * abs(mid - a[i].fi) + (long double)1.0 * a[i].se * a[i].se));
}
maxi(ans, tmp);
cout << setprecision(6) << fixed << ans;
}
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
// freopen(task".inp", "r", stdin);
// freopen(task".out", "w", stdout);
int T = 1;
// cin >> T;
for (int i = 1; i <= T; i++) {
solve(i);
}
return 0;
}
/*
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |