Submission #1100852

# Submission time Handle Problem Language Result Execution time Memory
1100852 2024-10-14T19:53:30 Z sano Mobile (BOI12_mobile) C++14
0 / 100
258 ms 41908 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<double, 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;

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));
}

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);
	double n, l;
	cin >> n >> l;
	vec<pii> p;
	vec<double> s;
	For(i, n) {
		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();
	double md = 0; bool prvy = false;
	For(i, (s.size() - 1)) {
		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 << 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 Expected double, but "inf" found
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 608 KB Expected double, but "inf" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 592 KB Expected double, but "inf" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 592 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 4304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 19 ms 1872 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 4808 KB Output is correct
2 Runtime error 24 ms 3788 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 34 ms 4292 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 4824 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 128 ms 20800 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 135 ms 9304 KB Execution killed with signal 7
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 160 ms 32176 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 168 ms 10804 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 177 ms 34492 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 185 ms 12392 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 192 ms 36796 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 219 ms 14044 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 233 ms 41908 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 258 ms 17484 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -