# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
903915 |
2024-01-11T14:20:57 Z |
tz74 |
Mobile (BOI12_mobile) |
C++17 |
|
726 ms |
33376 KB |
#include <iostream>
#include <vector>
#include <iomanip>
#include <ctgmath>
using namespace std;
using i64 = long long;
using f64 = double;
i64 N;
f64 L;
vector<pair<i64, i64> > towers;
f64 sq(f64 in) {
return in * in;
}
bool contiguous(f64 R) {
bool init = false;
f64 leftmost = -1;
f64 rightmost = -1;
for (int i = 0; i < N; i++) {
f64 x = towers[i].first;
f64 y = towers[i].second;
f64 d = sq(2.0 * x) - 4.0 * (sq(x) + sq(y) - sq(R));
if (d > 0) {
f64 x1 = (2.0 * x - sqrt(d)) / 2;
f64 x2 = (2.0 * x + sqrt(d)) / 2;
// printf("i: %d, x1: %lf, x2: %lf\n", i, x1, x2);
if (!init) {
init = true;
leftmost = x1;
rightmost = x2;
} else if (x1 < rightmost) {
rightmost = x2;
}
}
}
// printf("leftmost: %lf, rightmost: %lf\n", leftmost, rightmost);
return leftmost <= 0 && rightmost >= L;
}
int main(void) {
cin >> N >> L;
for (int i = 0; i < N; i++) {
pair<i64, i64> p;
cin >> p.first >> p.second;
towers.push_back(p);
}
// printf("contiguous: %d\n", contiguous(5.5454));
// return 0;
f64 lo = 1.0;
f64 hi = 1e9;
while (hi - lo > 0.00001) {
f64 mid = (hi + lo) / 2;
// we want the largest value where it's not contiguous
if (contiguous(mid)) {
hi = mid;
} else {
lo = mid;
}
}
cout << lo << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
352 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Incorrect |
1 ms |
356 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
604 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 |
Incorrect |
56 ms |
3212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
43 ms |
3268 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
47 ms |
3236 KB |
Output is correct |
2 |
Incorrect |
55 ms |
3524 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
69 ms |
3780 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
69 ms |
3532 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
270 ms |
12416 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
361 ms |
16464 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
331 ms |
22448 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
458 ms |
27412 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
393 ms |
23196 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
532 ms |
26496 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
440 ms |
23464 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
604 ms |
27540 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
557 ms |
25604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
726 ms |
33376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |