# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
698197 | randmac | Mobile (BOI12_mobile) | C++14 | 167 ms | 16452 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.
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <queue>
#include <math.h>
using namespace std;
// https://oj.uz/problem/view/BOI12_mobile
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
// freopen("mobile.in", "r", stdin);
// freopen("mobile.out", "w", stdout);
int N, L;
cin >> N >> L;
vector<pair<int, int>> a(N);
for (int i = 0; i < N; i++) {
cin >> a[i].first >> a[i].second;
}
vector<pair<int, int>> b;
int last_x = -1;
for (auto it : a) {
if (last_x != -1 && it.first == last_x) continue;
b.push_back(it);
last_x = it.first;
}
double ans = -1;
for (int i = 0; i < b.size() - 1; i++) {
int x_sum = b[i].first + b[i + 1].first;
int x_diff = b[i + 1].first - b[i].first;
double y_squared = (b[i + 1].second + b[i].second) * (b[i + 1].second - b[i].second);
double x_0 = ( y_squared / x_diff + x_sum) / 2;
double distance = (b[i].first - x_0) * (b[i].first - x_0) + b[i].second * b[i].second;
ans = max(ans, distance);
}
cout << sqrt(ans) << endl;
}
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... |