# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
623057 | 2022-08-05T06:43:04 Z | 54skyxenon | Mobile (BOI12_mobile) | C++17 | 1000 ms | 48020 KB |
// https://oj.uz/problem/view/BOI12_mobile #include <bits/stdc++.h> using namespace std; #define pdd pair<double, double> #define mp make_pair int n, l; vector<double> X, Y; vector<pdd> merge(vector<pdd>& intervals) { sort(intervals.begin(), intervals.end()); vector<pdd> new_intervals; for (auto [start, end] : intervals) { if (new_intervals.empty() || new_intervals.rbegin()->second < start) { new_intervals.push_back(mp(start, end)); } else { new_intervals.rbegin()->second = max(new_intervals.rbegin()->second, end); } } return new_intervals; } bool ok(double radius) { vector<pdd> intervals({mp(0, 0), mp(l, l)}); for (int i = 0; i < n; i++) { double x1 = X[i], y1 = Y[i]; double term = (radius * radius) - (y1 * y1); if (term >= 0) { double term_sqrt = sqrt(term); intervals.push_back(mp(x1 - term_sqrt, x1 + term_sqrt)); } } intervals = merge(intervals); for (int i = 0; i < intervals.size() - 1; i++) { double midpt = (intervals[i].second + intervals[i + 1].first) / 2; if (0 <= midpt && midpt <= l) { return true; } } return false; } int main() { cin >> n >> l; X.resize(n); Y.resize(n); for (int i = 0; i < n; i++) { cin >> X[i] >> Y[i]; } double lo = 0.0; double hi = l; int threshold = 1000; while (threshold--) { double mid = (lo + hi) / 2; if (!ok(mid)) { hi = mid; } else { lo = mid; } } cout << lo << endl; }
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 | 1 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 | 5 ms | 308 KB | Output is correct |
4 | Correct | 3 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 396 KB | Output is correct |
2 | Correct | 64 ms | 340 KB | Output is correct |
3 | Correct | 8 ms | 360 KB | Output is correct |
4 | Incorrect | 102 ms | 340 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 372 KB | Output is correct |
2 | Incorrect | 159 ms | 1940 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 376 KB | Output is correct |
2 | Incorrect | 162 ms | 580 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 291 ms | 708 KB | Output is correct |
2 | Incorrect | 154 ms | 596 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1089 ms | 4704 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 185 ms | 2656 KB | Output is correct |
2 | Correct | 177 ms | 2540 KB | Output is correct |
3 | Incorrect | 195 ms | 2720 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1091 ms | 5384 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1077 ms | 5548 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1092 ms | 5720 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1094 ms | 24268 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1086 ms | 24188 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1077 ms | 35536 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1090 ms | 35536 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1097 ms | 38648 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1090 ms | 38696 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1096 ms | 41736 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1090 ms | 41840 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1090 ms | 48020 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1091 ms | 32432 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |