# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1026861 |
2024-07-18T12:26:58 Z |
peyman_sf |
Mobile (BOI12_mobile) |
C++17 |
|
1000 ms |
10696 KB |
#include <iostream>
#include <fstream>
#include <iomanip>
#include <stack>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <deque>
#include <queue>
#define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define fileTesting ifstream fileIn("input.txt"); cin.rdbuf(fileIn.rdbuf()); ofstream fileOut("output.txt"); cout.rdbuf(fileOut.rdbuf());
#define endl '\n'
#define print(x) for (auto i : x) cout << i << ' '; cout << endl
#define nloop(a, n) for (ll i = a; i < n; i++)
#define debug(x) cerr << #x << " is " << x << endl
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define ff first
#define ss second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef pair<int, int> pii;
typedef pair<ld, ld> pld;
const ll maxN = 1e9;
const ll mod = 1e9 + 7;
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b);}
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
ll n, len;
vector<pii> points;
ld check(ld r) {
ld cl = 0, cr = 0;
for (auto &p : points)
{
ld d = sqrt(pow(r, 2) - pow(p.second, 2));
if (p.first - d > cr)
return 0;
else {
cl = min(cl, p.first - d);
cr = max(cr, p.first + d);
}
}
if (cl <= 0 && cr >= len)
return 1;
return 0;
}
void solution() {
cin >> n >> len;
for (ll i = 0; i < n; i++) {
ll x, y;
cin >> x >> y;
points.push_back(make_pair(x, y));
}
ld l = 0, r = len + 1, m;
for (ll i = 0; i < 200; i++) {
m = (l + r) / 2;
if (check(m))
r = m;
else
l = m;
}
cout << fixed << setprecision(6) << r << endl;
}
int main() {
FastIO
ll t = 1;
// cin >> t;
while (t--) {
solution();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
13 ms |
512 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
16 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
348 KB |
Output is correct |
2 |
Correct |
6 ms |
348 KB |
Output is correct |
3 |
Incorrect |
6 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
560 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
218 ms |
1500 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
293 ms |
1496 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
126 ms |
1496 KB |
Output is correct |
2 |
Incorrect |
24 ms |
1496 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
26 ms |
1500 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
116 ms |
1496 KB |
Output is correct |
2 |
Incorrect |
118 ms |
1496 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
651 ms |
5588 KB |
Output is correct |
2 |
Correct |
569 ms |
5828 KB |
Output is correct |
3 |
Correct |
533 ms |
4808 KB |
Output is correct |
4 |
Execution timed out |
1076 ms |
5836 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
522 ms |
6344 KB |
Output is correct |
2 |
Execution timed out |
1032 ms |
6136 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
726 ms |
8804 KB |
Output is correct |
2 |
Incorrect |
698 ms |
9404 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
660 ms |
9756 KB |
Output is correct |
2 |
Execution timed out |
1073 ms |
8644 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
873 ms |
10696 KB |
Output is correct |
2 |
Incorrect |
171 ms |
9420 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
175 ms |
9916 KB |
Output is correct |
2 |
Execution timed out |
1025 ms |
9340 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
959 ms |
10348 KB |
Output is correct |
2 |
Incorrect |
200 ms |
9600 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
847 ms |
10688 KB |
Output is correct |
2 |
Execution timed out |
1065 ms |
8644 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1079 ms |
9920 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
256 ms |
10588 KB |
Output is correct |
2 |
Execution timed out |
1100 ms |
9324 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |