# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
671172 | 2022-12-12T09:20:54 Z | vjudge1 | Mobile (BOI12_mobile) | C++14 | 890 ms | 30668 KB |
#include <iostream> #include <cstdio> #include <cmath> #include <cstring> #include <vector> #include <map> #include <set> #include <stack> #include <queue> #include <algorithm> using namespace std; #define rep(i, a, b) for(int i = a; i < (b); ++i) #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() #define mp make_pair #define pb push_back #define f first #define s second #define lb lower_bound #define ub upper_bound using vi = vector<int>; using ll = long long; using pii = pair<ll, int>; const int maxn = 1e6 + 7; double x[maxn], y[maxn]; double L; int n; bool check(double r) { vector<pair<double, double>> seg; rep(i, 0, n) { if (abs(y[i]) < r) { double dy = abs(y[i]); double tmp = r * r - dy * dy; double dx = sqrt(tmp); double x1 = x[i] - dx, x2 = x[i] + dx; if (x1 < 0.0 && x2 < 0.0) continue; if (x1 > L && x2 > L) continue; if (seg.empty()) { seg.push_back({x1, x2}); } else { while (!seg.empty()) { auto p = seg.back(); if (p.f >= x1 && p.s <= x2) { seg.pop_back(); } else if (p.f <= x1 && p.s >= x1) { seg.pop_back(); x1 = p.f; x2 = max(p.s, x2); } else { break; } } seg.push_back({x1, x2}); } } } if (seg.size() >= 1) { if (seg[0].f <= 0 && seg[0].s >= L) return true; } return false; } int main() { //ios::sync_with_stdio(false); scanf("%d %lf", &n, &L); rep(i, 0, n) { scanf("%lf %lf", &x[i], &y[i]); } double l = 0.0, r = 1e9; while (r - l > 0.0001) { double mid = l + (r - l) / 2.0; if (check(mid)) { r = mid; } else { l = mid; } } printf("%.6lf\n", l); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 308 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 340 KB | Output is correct |
2 | Correct | 3 ms | 340 KB | Output is correct |
3 | Correct | 2 ms | 340 KB | Output is correct |
4 | Correct | 2 ms | 360 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 340 KB | Output is correct |
2 | Correct | 5 ms | 456 KB | Output is correct |
3 | Correct | 5 ms | 468 KB | Output is correct |
4 | Correct | 3 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 444 KB | Output is correct |
3 | Correct | 4 ms | 320 KB | Output is correct |
4 | Correct | 3 ms | 396 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 340 KB | Output is correct |
2 | Correct | 5 ms | 444 KB | Output is correct |
3 | Correct | 5 ms | 320 KB | Output is correct |
4 | Correct | 3 ms | 468 KB | Output is correct |
5 | Correct | 4 ms | 320 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 51 ms | 1868 KB | Output is correct |
2 | Correct | 67 ms | 2508 KB | Output is correct |
3 | Correct | 41 ms | 1748 KB | Output is correct |
4 | Correct | 37 ms | 2544 KB | Output is correct |
5 | Correct | 29 ms | 1408 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 45 ms | 1996 KB | Output is correct |
2 | Correct | 38 ms | 2144 KB | Output is correct |
3 | Correct | 41 ms | 2588 KB | Output is correct |
4 | Correct | 38 ms | 2664 KB | Output is correct |
5 | Correct | 41 ms | 3064 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 74 ms | 2168 KB | Output is correct |
2 | Correct | 77 ms | 2244 KB | Output is correct |
3 | Correct | 65 ms | 2260 KB | Output is correct |
4 | Correct | 43 ms | 2376 KB | Output is correct |
5 | Correct | 49 ms | 2612 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 90 ms | 2372 KB | Output is correct |
2 | Correct | 101 ms | 2580 KB | Output is correct |
3 | Correct | 76 ms | 2516 KB | Output is correct |
4 | Correct | 44 ms | 2508 KB | Output is correct |
5 | Correct | 54 ms | 3116 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 65 ms | 2252 KB | Output is correct |
2 | Correct | 88 ms | 3248 KB | Output is correct |
3 | Correct | 77 ms | 2888 KB | Output is correct |
4 | Correct | 44 ms | 3288 KB | Output is correct |
5 | Correct | 51 ms | 3132 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 409 ms | 8752 KB | Output is correct |
2 | Correct | 441 ms | 9524 KB | Output is correct |
3 | Correct | 442 ms | 9688 KB | Output is correct |
4 | Correct | 214 ms | 9548 KB | Output is correct |
5 | Correct | 251 ms | 15180 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 440 ms | 8592 KB | Output is correct |
2 | Correct | 322 ms | 9720 KB | Output is correct |
3 | Correct | 380 ms | 13760 KB | Output is correct |
4 | Correct | 212 ms | 17448 KB | Output is correct |
5 | Correct | 236 ms | 15388 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 499 ms | 10196 KB | Output is correct |
2 | Correct | 529 ms | 11092 KB | Output is correct |
3 | Correct | 521 ms | 11120 KB | Output is correct |
4 | Correct | 255 ms | 11180 KB | Output is correct |
5 | Correct | 304 ms | 17632 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 524 ms | 10672 KB | Output is correct |
2 | Correct | 380 ms | 11212 KB | Output is correct |
3 | Correct | 453 ms | 16460 KB | Output is correct |
4 | Correct | 261 ms | 21324 KB | Output is correct |
5 | Correct | 289 ms | 18280 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 606 ms | 11764 KB | Output is correct |
2 | Correct | 625 ms | 12684 KB | Output is correct |
3 | Correct | 634 ms | 12776 KB | Output is correct |
4 | Correct | 304 ms | 12784 KB | Output is correct |
5 | Correct | 371 ms | 20276 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 656 ms | 12148 KB | Output is correct |
2 | Correct | 473 ms | 12812 KB | Output is correct |
3 | Correct | 564 ms | 19620 KB | Output is correct |
4 | Correct | 315 ms | 24612 KB | Output is correct |
5 | Correct | 380 ms | 21380 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 730 ms | 13328 KB | Output is correct |
2 | Correct | 726 ms | 13964 KB | Output is correct |
3 | Correct | 691 ms | 13880 KB | Output is correct |
4 | Correct | 330 ms | 13900 KB | Output is correct |
5 | Correct | 399 ms | 13916 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 700 ms | 13708 KB | Output is correct |
2 | Correct | 470 ms | 13980 KB | Output is correct |
3 | Correct | 606 ms | 22352 KB | Output is correct |
4 | Correct | 347 ms | 28264 KB | Output is correct |
5 | Correct | 395 ms | 24460 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 827 ms | 16476 KB | Output is correct |
2 | Correct | 869 ms | 17084 KB | Output is correct |
3 | Correct | 858 ms | 17016 KB | Output is correct |
4 | Correct | 429 ms | 17148 KB | Output is correct |
5 | Correct | 505 ms | 29484 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 890 ms | 16332 KB | Output is correct |
2 | Correct | 595 ms | 17020 KB | Output is correct |
3 | Correct | 753 ms | 28320 KB | Output is correct |
4 | Correct | 430 ms | 17408 KB | Output is correct |
5 | Correct | 489 ms | 30668 KB | Output is correct |