# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
990994 | 2024-06-01T03:29:18 Z | chanhchuong123 | Mobile (BOI12_mobile) | C++14 | 952 ms | 21500 KB |
#include<bits/stdc++.h> using namespace std; const bool multiTest = false; #define task "" #define fi first #define se second #define MASK(i) (1LL << (i)) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define BIT(mask, i) ((mask) >> (i) & 1) template<typename T1, typename T2> bool mini(T1 &a, T2 b) { if (a > b) a = b; else return 0; return 1; } template<typename T1, typename T2> bool maxi(T1 &a, T2 b) { if (a < b) a = b; else return 0; return 1; } const int MAX = 1000100; int n, l, m; int x[MAX]; int y[MAX]; bool ok(double dist) { if (x[1] - sqrt(dist - 1LL * y[1] * y[1]) >= 0) return true; if (x[m] + sqrt(dist - 1LL * y[m] * y[m]) <= l) return true; for (int i = 1; i <= m - 1; ++i) { double l = x[i] + sqrt(dist - 1LL * y[i] * y[i]), r = x[i + 1] - sqrt(dist - 1LL * y[i + 1] * y[i + 1]); if (l <= r) return true; } return false; } void process(void) { cin >> n >> l; x[0] = -1e9 - 7; y[0] = -1e9 - 7; for (int i = 1; i <= n; ++i) { int X, Y; cin >> X >> Y; if (x[m] != X) { ++m; x[m] = X; y[m] = abs(Y); } else mini(y[m], abs(Y)); } double l = 0, r = 5 * 1e18 + 1; for (int t = 1; t <= 150; ++t) { double mid = (l + r) / 2; if (ok(mid)) l = mid; else r = mid; } cout << setprecision(6) << fixed << sqrt(l); } int main(void) { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); if (fopen(task".inp", "r")) { freopen(task".inp", "r", stdin); freopen(task".out", "w", stdout); } int nTest = 1; if (multiTest) cin >> nTest; while (nTest--) { process(); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 2396 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 2396 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 2648 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 73 ms | 5468 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 12 ms | 3160 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 35 ms | 5204 KB | Output is correct |
2 | Incorrect | 49 ms | 5724 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 20 ms | 4184 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 95 ms | 8284 KB | Output is correct |
2 | Incorrect | 42 ms | 4028 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 148 ms | 10996 KB | Output is correct |
2 | Correct | 72 ms | 10068 KB | Output is correct |
3 | Correct | 61 ms | 9556 KB | Output is correct |
4 | Incorrect | 565 ms | 16328 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 65 ms | 10724 KB | Output is correct |
2 | Incorrect | 529 ms | 13376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 504 ms | 11940 KB | Output is correct |
2 | Incorrect | 88 ms | 11604 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 76 ms | 12348 KB | Output is correct |
2 | Incorrect | 595 ms | 14672 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 573 ms | 13140 KB | Output is correct |
2 | Incorrect | 88 ms | 13244 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 84 ms | 14012 KB | Output is correct |
2 | Incorrect | 710 ms | 16220 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 659 ms | 14416 KB | Output is correct |
2 | Incorrect | 89 ms | 14776 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 93 ms | 15672 KB | Output is correct |
2 | Incorrect | 839 ms | 17992 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 785 ms | 16724 KB | Output is correct |
2 | Incorrect | 130 ms | 18004 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 121 ms | 19028 KB | Output is correct |
2 | Incorrect | 952 ms | 21500 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |