Submission #460572

# Submission time Handle Problem Language Result Execution time Memory
460572 2021-08-09T07:38:16 Z shivensinha4 Mobile (BOI12_mobile) C++17
40 / 100
1000 ms 81112 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*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 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 1 ms 312 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 316 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 648 KB Output is correct
2 Correct 19 ms 648 KB Output is correct
3 Correct 10 ms 532 KB Output is correct
4 Correct 17 ms 648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 912 KB Output is correct
2 Correct 34 ms 1124 KB Output is correct
3 Correct 44 ms 948 KB Output is correct
4 Correct 17 ms 1024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 948 KB Output is correct
2 Correct 34 ms 1100 KB Output is correct
3 Correct 67 ms 944 KB Output is correct
4 Correct 16 ms 1012 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 59 ms 932 KB Output is correct
2 Correct 34 ms 908 KB Output is correct
3 Correct 67 ms 904 KB Output is correct
4 Correct 20 ms 916 KB Output is correct
5 Correct 26 ms 1004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 458 ms 9168 KB Output is correct
2 Correct 760 ms 9312 KB Output is correct
3 Correct 489 ms 5772 KB Output is correct
4 Correct 309 ms 9188 KB Output is correct
5 Correct 286 ms 6008 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 411 ms 9356 KB Output is correct
2 Correct 350 ms 9680 KB Output is correct
3 Correct 354 ms 10584 KB Output is correct
4 Correct 312 ms 10824 KB Output is correct
5 Correct 278 ms 11328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 739 ms 10044 KB Output is correct
2 Correct 842 ms 9716 KB Output is correct
3 Correct 972 ms 9736 KB Output is correct
4 Correct 269 ms 12632 KB Output is correct
5 Correct 421 ms 10972 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 10984 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 909 ms 10796 KB Output is correct
2 Execution timed out 1080 ms 10768 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 48132 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 48052 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 68484 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 68308 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 71516 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 71476 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 74756 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1081 ms 74596 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1074 ms 80864 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 81112 KB Time limit exceeded
2 Halted 0 ms 0 KB -