Submission #460510

# Submission time Handle Problem Language Result Execution time Memory
460510 2021-08-09T07:21:13 Z shivensinha4 Mobile (BOI12_mobile) C++17
0 / 100
1000 ms 80868 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 = 1e15, ans = l;
	while (l < r) {
		ll mid = (l+r)/2;
		bool hole = false;
		vector<ii> seg;
		for_(i, 0, n) if (mid >= 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 (i[0] <= cr) cr = max(i[1], cr);
			else {
				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 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 48 ms 996 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 960 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 58 ms 936 KB Output is correct
2 Correct 37 ms 1120 KB Output is correct
3 Correct 71 ms 948 KB Output is correct
4 Incorrect 91 ms 1068 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 424 ms 9220 KB Output is correct
2 Correct 828 ms 10360 KB Output is correct
3 Correct 495 ms 6476 KB Output is correct
4 Execution timed out 1084 ms 10460 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 967 ms 9444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 777 ms 10008 KB Output is correct
2 Correct 990 ms 10764 KB Output is correct
3 Execution timed out 1075 ms 10712 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 10712 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 919 ms 10720 KB Output is correct
2 Execution timed out 1088 ms 10772 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1081 ms 48144 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 48044 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1081 ms 68404 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1077 ms 68500 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 71524 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1078 ms 71420 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1083 ms 74584 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 74592 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1095 ms 80868 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1096 ms 80864 KB Time limit exceeded
2 Halted 0 ms 0 KB -