Submission #684705

# Submission time Handle Problem Language Result Execution time Memory
684705 2023-01-22T11:02:05 Z nayhz Mobile (BOI12_mobile) C++17
0 / 100
355 ms 16676 KB
// source identifier task_name
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
#define lck cout << "ick bmi 32.9\n"
#define cam_cs cout << "ick orz\n"
#define orz(x) cout << (x) << " orz\n"

#define pii pair<int, int>
#define pll pair<long long, long long>
#define pcc pair<char, char>
#define ll long long
#define ull unsigned long long
#define ld long double
#define int long long

#define vi vector<int>
#define vll vector<long long>
#define vd vector<double>
#define vpii vector<pair<int, int>>
#define vpll vector<pair<long long, long long>>
#define vc vector<char>
#define vsc vector<string>
#define vb vector<bool>

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define yes() cout << "Yes\n"
#define no() cout << "No\n"
#define impossible() cout << "Impossible\n"

template<typename T, typename V>
inline void print (const std::pair<T, V> &x) {std::cout << x.first << ' ' << x.second << '\n';}
template<typename T>
inline void print (const T &x) {std::cout << x << '\n';}
template<typename T>
inline void print (std::vector<T> &x) {for (auto &y : x) std::cout << y << " "; std::cout << '\n';}
inline void print () {std::cout << '\n';}
using namespace std;

const ld pi = acos(-1);
const ld eps = 1e-9;
const ll mod = 1000000007;
const ll inf = 1000000007;

clock_t T, NT;
inline double get_time() {NT = clock() - T; return (double)(NT) / CLOCKS_PER_SEC;}

void file_io (string x);

/*
>>>>>>>>>>>>>>>>>>>>>>>>>>END OF TEMPLATE HEADER<<<<<<<<<<<<<<<<<<<<<<<<
*/

void solve (/*int &tc*/) {
	int n, len; cin >> n >> len;
	vpii a(n);
	for (auto &x : a) cin >> x.fi >> x.se;

	double l = 1, r = 1.5e9, mid;
	double curr, temp, lb, rb;
	while (r - l > 1e-3) {
		mid = (l + r) / 2;
		curr = 0;

		for (int i = 0; i < n; i++) {
			temp = sqrt(mid * mid - a[i].se * a[i].se);
			lb = a[i].fi - temp, rb = a[i].fi + temp;

			if (lb <= curr) curr = rb;
			if (curr >= len) break;
		}
		if (curr >= len) r = mid;
		else l = mid;
	}
	cout << fixed << setprecision(4) << l << '\n';
}

signed main () {
	cin.tie(0)->sync_with_stdio(false);
	T = clock();
	srand(time(NULL));
	// file_io("");

	int t = 1;
	// cin >> t;
	for (int i = 1; i <= t; i++) {
		solve(/*i*/);
		// if (i != t) cout << '\n';
	}
	// while (true) {solve(t); t++;}
	return 0;
}

// void file_io (string x = "x") {
// 	string i = x + ".in";
// 	freopen(i.c_str(), "r", stdin);
// 	string o = x + ".out";
// 	freopen(o.c_str(), "w", stdout);
// }
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Incorrect 1 ms 332 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 464 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Incorrect 3 ms 468 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 1620 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 1620 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 18 ms 1800 KB Output is correct
2 Correct 19 ms 1672 KB Output is correct
3 Correct 27 ms 1764 KB Output is correct
4 Incorrect 38 ms 2028 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 25 ms 1916 KB Output is correct
2 Correct 25 ms 1924 KB Output is correct
3 Correct 25 ms 2004 KB Output is correct
4 Incorrect 36 ms 2056 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 28 ms 1964 KB Output is correct
2 Correct 22 ms 2004 KB Output is correct
3 Correct 25 ms 2004 KB Output is correct
4 Incorrect 40 ms 2096 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 108 ms 8308 KB Output is correct
2 Correct 125 ms 8580 KB Output is correct
3 Correct 134 ms 8808 KB Output is correct
4 Incorrect 173 ms 8652 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 120 ms 8620 KB Output is correct
2 Incorrect 184 ms 8408 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 125 ms 9948 KB Output is correct
2 Correct 139 ms 10036 KB Output is correct
3 Correct 125 ms 10060 KB Output is correct
4 Incorrect 231 ms 10080 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 142 ms 9976 KB Output is correct
2 Incorrect 223 ms 9972 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 151 ms 11492 KB Output is correct
2 Correct 151 ms 11796 KB Output is correct
3 Correct 139 ms 11560 KB Output is correct
4 Incorrect 274 ms 11608 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 158 ms 11724 KB Output is correct
2 Incorrect 255 ms 11536 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 174 ms 13220 KB Output is correct
2 Correct 181 ms 13364 KB Output is correct
3 Correct 190 ms 13244 KB Output is correct
4 Incorrect 285 ms 13372 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 188 ms 13240 KB Output is correct
2 Incorrect 301 ms 13092 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 220 ms 16572 KB Output is correct
2 Correct 211 ms 16660 KB Output is correct
3 Correct 240 ms 16352 KB Output is correct
4 Incorrect 345 ms 15984 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 242 ms 16676 KB Output is correct
2 Incorrect 355 ms 16348 KB Output isn't correct
3 Halted 0 ms 0 KB -