# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1100854 |
2024-10-14T19:55:25 Z |
sano |
Mobile (BOI12_mobile) |
C++14 |
|
498 ms |
69992 KB |
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<string>
#include<fstream>
#include<algorithm>
#include <iomanip>
#include<map>
#include <set>
#include <unordered_map>
#include <stack>
#include <unordered_set>
#include <cmath>
#define ll long long
#define For(i, n) for(ll i = 0; i < (ll)n; i++)
#define ffor(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define rfor(i, n) for(ll i = (ll)n; i >= (ll)0; i--)
#define rffor(i, a, n) for(ll i = (ll)n; i >= (ll)a; i--)
#define vec vector
#define ff first
#define ss second
#define pb push_back
#define shit short double
#define pii pair<long double, long double>
#define NEK 2147483640
#define mod 1000000007
#define mod2 1000000009
#define rsz resize
#define prv1 43
#define prv2 47
#define D 8
using namespace std;
long double bod(pii a, pii b) {
return (b.first * b.first + b.second * b.second - a.first * a.first - a.second * a.second) / (2 * (b.first - a.first));
}
long double dist(pii a, pii b) {
return sqrt(abs(a.ff - b.ff) * abs(a.ff - b.ff) + abs(a.ss - b.ss) * (abs(a.ss - b.ss)));
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
long double n, l;
cin >> n >> l;
vec<pii> p;
vec<long double> s;
For(i, n) {
long double x, y;
cin >> x >> y;
y = abs(y);
if (!p.empty()) {
if (p.back().ff == x) {
if (p.back().ss > y) {
p.pop_back();
p.push_back({ x, y });
}
continue;
}
}
p.push_back({ x, y });
}
For(i, n) {
while (s.size() > 1 && bod(p[s[s.size() - 2]], p[s.back()]) > bod(p[s.back()], p[i])) s.pop_back();
s.push_back(i);
}
while (s.size() > 1 && bod(p[s[s.size() - 2]], p[s.back()]) > l) s.pop_back();
long double md = 0; bool prvy = false;
For(i, (s.size() - 1)) {
long double hod = bod(p[s[i]], p[s[i + 1]]);
if (hod < 0) continue;
if (prvy == false) {
md = dist(p[s[i]], { 0, 0 });
prvy = true;
}
md = max(md, dist(p[s[i]], { hod, 0 }));
md = max(md, dist(p[s[i + 1]], { hod, 0 }));
}
md = max(md, dist(p[s.back()], { l, 0 }));
cout << fixed << setprecision(3);
cout << md << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
848 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
1104 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
848 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
7372 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
20 ms |
1236 KB |
Execution killed with signal 7 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
7796 KB |
Output is correct |
2 |
Runtime error |
33 ms |
5572 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
40 ms |
6336 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
43 ms |
6748 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
241 ms |
35128 KB |
Output is correct |
2 |
Runtime error |
144 ms |
9512 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
143 ms |
1484 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
291 ms |
48472 KB |
Output is correct |
2 |
Runtime error |
168 ms |
10456 KB |
Execution killed with signal 7 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
161 ms |
6332 KB |
Execution killed with signal 7 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
362 ms |
51376 KB |
Output is correct |
2 |
Runtime error |
205 ms |
11908 KB |
Execution killed with signal 7 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
191 ms |
1220 KB |
Execution killed with signal 7 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
394 ms |
56236 KB |
Output is correct |
2 |
Runtime error |
220 ms |
13528 KB |
Execution killed with signal 7 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
215 ms |
980 KB |
Execution killed with signal 7 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
498 ms |
69992 KB |
Output is correct |
2 |
Runtime error |
262 ms |
16836 KB |
Execution killed with signal 7 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
298 ms |
9564 KB |
Execution killed with signal 7 |
2 |
Halted |
0 ms |
0 KB |
- |