# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
654420 |
2022-10-31T09:23:37 Z |
yhussain11 |
Mobile (BOI12_mobile) |
C++17 |
|
1000 ms |
16332 KB |
#include<bits/stdc++.h>
#define unless(x) if (!(x))
#define pb push_back
#define eb emplace_back
/* #define f first */
/* #define s second */
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define mem(x, y) memset(x, y, sizeof(x))
#define sz(x) ((int) (x).size())
#define popcnt __builtin_popcntll
using namespace std;
using ll = long long;
using ld = long double;
using pi = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vpi = vector<pi>;
using vpll = vector<pll>;
using vvi = vector<vector<int>>;
// *INDENT-OFF*
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template<typename T, typename V> void __print(const pair<T, V> &x) { cerr << '{'; __print(x.first); cerr << ", "; __print(x.second); cerr << '}'; }
template<size_t I = 0, typename... Tp> void __print_tup(const tuple<Tp...>& t) { cerr << get<I>(t); if constexpr(I < sizeof...(Tp) - 1) { cerr << ", "; __print_tup<I+1>(t); } }
template<typename... Tp> void __print(const tuple<Tp...>& t) { cerr << '{'; __print_tup(t); cerr << '}'; }
/* template<typename... Args> void __print(const tuple<Args...>& t) { cerr << '{'; apply([](auto&&... args) { ((cout << args << ','), ...); }, t); cerr << '}'; } */
template<typename T> void __print(const T &x) { int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? ", " : ""), __print(i); cerr << "}"; }
void _print() { cerr << "]\n"; }
template <typename T, typename... V> void _print(T t, V... v) { __print(t); if (sizeof...(v)) cerr << ", "; _print(v...); }
template<typename T> T fdiv(T x, T y) { T q = x / y; T r = x % y; if ((r != 0) && ((r < 0) != (y < 0))) --q; return q; }
template<typename T> T cdiv(T x, T y) { return x / y + ((x % y != 0) ? !((x > 0) ^ (y > 0)) : 0); }
namespace std { template<class Fun> class y_combinator_result { Fun fun_; public: template<class T> explicit y_combinator_result(T &&fun): fun_(std::forward<T>(fun)) {} template<class ...Args> decltype(auto) operator()(Args &&...args) { return fun_(std::ref(*this), std::forward<Args>(args)...); } }; template<class Fun> decltype(auto) yy(Fun &&fun) { return y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun)); } }
const string yes = "Yes";
const string no = "No";
const int infs = 0x3f;
const int infb = 0x3f3f3f3f;
#ifdef LOCAL
#define dbg(x...) cerr << "\e[1;31m"<<__func__<<":"<<__LINE__<<" [" << #x << "] = ["; _print(x); cerr << "\e[0m";
#else
#define dbg(x...)
#endif
// *INDENT-ON*
// YOU ARE ACTUALLY **SUPPOSED** TO READ THE FOLLOWING.
// Read the problem. Now Re-read the problem.
// Observe each constraint. Please do this. Notice each and every constraint.
// You have made many mistakes because you didn't read the constraint well enough.
// You are probably solving a harder version of the given problem.
// DO NOT OVERSOLVE.
// Do not look ahead for next problem. Solve the current problem.
// Do not look at standings.
// check overflow/underflow
// Declare double values as long double or ld (NEVER double, because of precision issues)
// Open the damn Excel Sheet!!!!
// BE EXTRA EXTRA EXTRA CAREFUL WHILE MULTIPLYING!!!!! <- SEE THIS!!! SEE THIS!!!
void solve() {
int n, l;
cin >> n >> l;
vpll v(n);
for (auto &[a, b] : v) {
cin >> a >> b;
}
ld epsilon = 1.0L / 1e9;
ld lo = 0, hi = 4e9;
while (hi - lo > epsilon) {
ld mid = (lo + hi) / 2;
int flg = 0;
ld left = 2e9, right = -2e9;
for (auto [a, b] : v) {
if (mid >= b) {
ld D = mid * mid - b * b;
ld lefti = a - sqrt(D);
ld righti = a + sqrt(D);
if (flg == 0) {
flg = 1;
left = lefti;
right = righti;
} else {
if (max(left, lefti) <= min(right, righti)) {
ckmin(left, lefti);
ckmax(right, righti);
}
}
}
}
if (left <= 0 && right >= l) {
hi = mid;
} else {
lo = mid;
}
}
cout << fixed << setprecision(6) << lo << '\n';
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int t = 1;
/* cin >> t; */
while (t--) {
solve();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
316 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
320 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
320 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
340 KB |
Output is correct |
2 |
Correct |
5 ms |
468 KB |
Output is correct |
3 |
Correct |
5 ms |
340 KB |
Output is correct |
4 |
Correct |
11 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
340 KB |
Output is correct |
2 |
Correct |
5 ms |
340 KB |
Output is correct |
3 |
Correct |
5 ms |
340 KB |
Output is correct |
4 |
Incorrect |
9 ms |
468 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
60 ms |
1872 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
69 ms |
1868 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
76 ms |
2000 KB |
Output is correct |
2 |
Correct |
70 ms |
1992 KB |
Output is correct |
3 |
Correct |
60 ms |
2112 KB |
Output is correct |
4 |
Incorrect |
177 ms |
2340 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
93 ms |
2260 KB |
Output is correct |
2 |
Correct |
87 ms |
2260 KB |
Output is correct |
3 |
Correct |
71 ms |
2388 KB |
Output is correct |
4 |
Incorrect |
213 ms |
2380 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
87 ms |
2260 KB |
Output is correct |
2 |
Correct |
95 ms |
2264 KB |
Output is correct |
3 |
Correct |
81 ms |
2380 KB |
Output is correct |
4 |
Incorrect |
209 ms |
2408 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
401 ms |
8532 KB |
Output is correct |
2 |
Correct |
439 ms |
8532 KB |
Output is correct |
3 |
Correct |
484 ms |
8660 KB |
Output is correct |
4 |
Incorrect |
985 ms |
8472 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
431 ms |
8532 KB |
Output is correct |
2 |
Incorrect |
421 ms |
8616 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
534 ms |
10100 KB |
Output is correct |
2 |
Correct |
554 ms |
9940 KB |
Output is correct |
3 |
Correct |
507 ms |
10028 KB |
Output is correct |
4 |
Incorrect |
581 ms |
9996 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
504 ms |
9940 KB |
Output is correct |
2 |
Correct |
496 ms |
10180 KB |
Output is correct |
3 |
Correct |
398 ms |
10136 KB |
Output is correct |
4 |
Execution timed out |
1086 ms |
10068 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
564 ms |
11604 KB |
Output is correct |
2 |
Correct |
613 ms |
11540 KB |
Output is correct |
3 |
Correct |
592 ms |
11604 KB |
Output is correct |
4 |
Execution timed out |
1087 ms |
11604 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
640 ms |
11476 KB |
Output is correct |
2 |
Correct |
517 ms |
11596 KB |
Output is correct |
3 |
Correct |
522 ms |
11604 KB |
Output is correct |
4 |
Execution timed out |
1088 ms |
11604 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
664 ms |
13140 KB |
Output is correct |
2 |
Correct |
701 ms |
13012 KB |
Output is correct |
3 |
Correct |
673 ms |
13128 KB |
Output is correct |
4 |
Execution timed out |
1078 ms |
13232 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
694 ms |
13012 KB |
Output is correct |
2 |
Incorrect |
574 ms |
13164 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
842 ms |
16212 KB |
Output is correct |
2 |
Correct |
855 ms |
16212 KB |
Output is correct |
3 |
Correct |
876 ms |
16332 KB |
Output is correct |
4 |
Execution timed out |
1092 ms |
15996 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
865 ms |
15956 KB |
Output is correct |
2 |
Correct |
753 ms |
16320 KB |
Output is correct |
3 |
Correct |
710 ms |
16260 KB |
Output is correct |
4 |
Incorrect |
1000 ms |
15936 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |