# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
697519 | vjudge1 | Mobile (BOI12_mobile) | C++17 | 40 ms | 16552 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// euzubillahimineşşeytanirracimbismillahirrahmanirrahim
// <- bak boşluk tuşun çalışıyo niye kullanmıyon
#include <bits/stdc++.h>
using namespace std;
#define fileio() freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define fastio() cin.tie(0), ios_base::sync_with_stdio(0)
#define pb push_back
#define pii pair<int ,int>
#define st first
#define nd second
#define sp " "
#define endl "\n"
#define N 1000005
#define int long long
int x[N], y[N];
double l[N], r[N], sq[N];
const int INF = 1e18 + 7;
int32_t main()
{
#ifndef ONLINE_JUDGE
fileio();
#endif
fastio();
queue<int> q;
int n, L;
cin >> n >> L;
for (int i = 1; i <= n; i++)
{
cin >> x[i] >> y[i];
sq[i] = x[i] * x[i] + y[i] * y[i];
}
q.push(1);
l[1] = 0, r[1] = L;
for (int i = 1; i <= n; i++)
{
int last = q.front();
if (x[i] == x[last]) continue;
l[i] = INF;
double p = (sq[i] - sq[last]) / (2 * (x[i] - x[last]));
p = max(p, (double)0);
while (p < l[last])
{
q.pop();
if (q.empty()) continue;
last = q.front();
p = (sq[i] - sq[last]) / (2 * (x[i] - x[last]));
p = max(p, (double)0);
}
if (!q.empty())
{
int last = q.front();
p = (sq[i] - sq[last]) / (2 * (x[i] - x[last]));
p = max(p, (double)0);
r[last] = p;
}
l[i] = p;
r[i] = L;
if (l[i] <= r[i]) q.push(i);
}
double ans = 0;
for (int i = 1; i <= n; i++)
{
double gh = abs(x[i] - r[i]);
double dist = y[i] * y[i] + gh * gh;
ans = max(ans, dist);
gh = abs(x[i] - l[i]);
dist = y[i] * y[i] + gh * gh;
ans = max(ans, dist);
}
double res = sqrt(ans);
printf("%.5f\n", res);
cerr<<"time taken : "<<(float)clock() / CLOCKS_PER_SEC<<" seconds\n";
}
Compilation message (stderr)
# | 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... |