# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
902532 |
2024-01-10T15:13:19 Z |
tz74 |
Mobile (BOI12_mobile) |
C++17 |
|
533 ms |
25472 KB |
#include <iostream>
#include <vector>
#include <iomanip>
#include <ctgmath>
using namespace std;
using i64 = long long;
using f64 = double;
f64 dist(f64 a, f64 b, f64 c, f64 d) {
return sqrt((c - a) * (c - a) + (d - b) * (d - b));
}
int main(void) {
i64 N_tmp, L; cin >> N_tmp >> L;
vector<pair<i64, i64> > towers;
for (int i = 0; i < N_tmp; i++) {
pair<i64, i64> p;
cin >> p.first >> p.second;
// printf("p: %lld, %lld\n", p.first, p.second);
if (i == 0 || towers.back().first != p.first) {
towers.push_back(p);
} else {
towers.pop_back();
}
}
f64 max_dist = 0;
i64 N = towers.size();
for (int i = 0, j = 1; i < N - 1 && j < N; i++, j++) {
f64 P1_x = towers[i].first;
f64 P1_y = towers[i].second;
f64 P2_x = towers[j].first;
f64 P2_y = towers[j].second;
f64 x = (P2_x * P2_x - P1_x * P1_x + P2_y * P2_y - P1_y * P1_y) / (2 * (P2_x - P1_x));
max_dist = max(max_dist, dist(P1_x, P1_y, x, 0));
}
// then try two endpoints
max_dist = max(max_dist, dist(towers[0].first, towers[0].second, 0, 0));
if (L >= towers[N - 1].first) {
max_dist = max(max_dist, dist(towers[N - 1].first, towers[N - 1].second, 0, N));
}
cout << setprecision(10);
cout << max_dist << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
28 ms |
2244 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
31 ms |
1120 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
29 ms |
3252 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
49 ms |
2664 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
71 ms |
3868 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
183 ms |
12468 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
247 ms |
8788 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
204 ms |
23472 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
304 ms |
10320 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
277 ms |
21972 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
335 ms |
11856 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
294 ms |
22544 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
411 ms |
13616 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
416 ms |
25472 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
533 ms |
17164 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |