Submission #460574

# Submission time Handle Problem Language Result Execution time Memory
460574 2021-08-09T07:39:00 Z shivensinha4 Mobile (BOI12_mobile) C++17
8 / 100
1000 ms 80956 KB
#include <bits/stdc++.h>
#ifdef mlocal
#include "./Competitive-Code-Library/snippets/prettyprint.h"
#endif
using namespace std;
#define for_(i, s, e) for (int i = s; i < (int) e; i++)
#define for__(i, s, e) for (ll i = s; i < e; i++)
typedef long double ll;
typedef vector<int> vi;
typedef array<ll, 2> ii;
#define endl '\n'

const ll K = 1e5;

int main() {
#ifdef mlocal
	freopen("test.in", "r", stdin);
#endif
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	ll n, len; cin >> n >> len;
	len *= K;
	vector<ii> pts(n);
	for_(i, 0, n) {
		for_(j, 0, 2) {
			cin >> pts[i][j];
			pts[i][j] *= K;
		}
	}
	
	ll l = 0, r = 1e10, ans = l;
	while (l < r) {
		ll mid = (l+r)/2;
		bool hole = false;
		vector<ii> seg;
		for_(i, 0, n) if (mid*mid >= pts[i][1]*pts[i][1]) {
			ll sq = sqrtl(mid*mid - pts[i][1]*pts[i][1]);
			seg.push_back({pts[i][0]-sq, pts[i][0]+sq});
		}
		sort(seg.begin(),  seg.end());
		
		ll cr = 0;
		for (auto &i: seg) {
			if (cr >= len) break;
			if (i[0] <= cr) cr = max(i[1], cr);
			/*else {
				continue;
//				hole = true;
//				break;
			}*/
		}
		
		if (hole or cr < len) {
			ans = mid;
			l = mid+1;
		} else r = mid;
	}
	
	cout << fixed << setprecision(10) << ans/K << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 628 KB Output is correct
2 Correct 11 ms 632 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Incorrect 16 ms 616 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 888 KB Output is correct
2 Incorrect 33 ms 1012 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 888 KB Output is correct
2 Incorrect 38 ms 952 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 58 ms 944 KB Output is correct
2 Incorrect 24 ms 908 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 418 ms 9140 KB Output is correct
2 Incorrect 754 ms 9356 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 188 ms 9332 KB Output is correct
2 Correct 124 ms 8764 KB Output is correct
3 Correct 92 ms 5040 KB Output is correct
4 Correct 91 ms 2936 KB Output is correct
5 Incorrect 85 ms 3024 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 9952 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1033 ms 10768 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 10780 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1100 ms 48120 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 23324 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 68412 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 26388 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 71484 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 29484 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 74624 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 32616 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 80956 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1058 ms 38880 KB Time limit exceeded
2 Halted 0 ms 0 KB -