답안 #829826

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
829826 2023-08-18T15:16:05 Z soumyojit_sen Mobile (BOI12_mobile) C++14
100 / 100
590 ms 30716 KB
#include <iostream>
#include <vector>
#include <math.h>
#include <iomanip>
using namespace std;
vector<pair<double, double>> pts;
int n;
double L;

bool works(double d){
	// whether a radius of d is enough to intersect all the circles
	double currDistCovered = 0.0;
	for(int i = 0; i < n; i++){
		// find the segment covered by ith circle on the highway
		// radius^2 = yi^2 + dist^2
		double dist = sqrt(d*d - pts[i].second*pts[i].second);
		double start = pts[i].first - dist;
		double end = pts[i].first + dist;

		if(start <= currDistCovered){
			currDistCovered = max(currDistCovered, end);
		}
	}
	return currDistCovered >= L;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> n >> L;
	pts.resize(n);
	for(int i = 0; i < n; i++) cin >> pts[i].first >> pts[i].second;

	double good = 1.5e9;
	double bad = -1.0;
	
	for(int i = 0; i < 50; i++){
		double mid = bad + (good - bad)/2;
		//cout << fixed << setprecision(6) << i << " " << mid <<"\n" ;
		if(works(mid)){
			good = mid;
		} else {
			bad = mid;
		}
	}
	cout << fixed << setprecision(12) << good;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 3 ms 456 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 3 ms 328 KB Output is correct
4 Correct 3 ms 460 KB Output is correct
5 Correct 3 ms 436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 47 ms 1492 KB Output is correct
2 Correct 37 ms 1492 KB Output is correct
3 Correct 25 ms 1108 KB Output is correct
4 Correct 41 ms 2644 KB Output is correct
5 Correct 23 ms 1420 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 1492 KB Output is correct
2 Correct 35 ms 1364 KB Output is correct
3 Correct 42 ms 2260 KB Output is correct
4 Correct 47 ms 2688 KB Output is correct
5 Correct 48 ms 3080 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 1620 KB Output is correct
2 Correct 40 ms 2248 KB Output is correct
3 Correct 39 ms 2532 KB Output is correct
4 Correct 59 ms 3784 KB Output is correct
5 Correct 45 ms 2636 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 51 ms 1876 KB Output is correct
2 Correct 46 ms 1876 KB Output is correct
3 Correct 46 ms 2896 KB Output is correct
4 Correct 58 ms 3780 KB Output is correct
5 Correct 51 ms 3016 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 1876 KB Output is correct
2 Correct 49 ms 2592 KB Output is correct
3 Correct 45 ms 2916 KB Output is correct
4 Correct 64 ms 3764 KB Output is correct
5 Correct 52 ms 3036 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 214 ms 8144 KB Output is correct
2 Correct 236 ms 8148 KB Output is correct
3 Correct 240 ms 8148 KB Output is correct
4 Correct 278 ms 8148 KB Output is correct
5 Correct 258 ms 8148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 236 ms 8148 KB Output is correct
2 Correct 317 ms 8148 KB Output is correct
3 Correct 228 ms 8148 KB Output is correct
4 Correct 294 ms 8148 KB Output is correct
5 Correct 272 ms 8148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 257 ms 9684 KB Output is correct
2 Correct 287 ms 10452 KB Output is correct
3 Correct 317 ms 13268 KB Output is correct
4 Correct 348 ms 13120 KB Output is correct
5 Correct 316 ms 13284 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 288 ms 9684 KB Output is correct
2 Correct 377 ms 9684 KB Output is correct
3 Correct 271 ms 13200 KB Output is correct
4 Correct 355 ms 13220 KB Output is correct
5 Correct 321 ms 13232 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 299 ms 11220 KB Output is correct
2 Correct 332 ms 12144 KB Output is correct
3 Correct 327 ms 14848 KB Output is correct
4 Correct 401 ms 14652 KB Output is correct
5 Correct 364 ms 14840 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 336 ms 11196 KB Output is correct
2 Correct 432 ms 11264 KB Output is correct
3 Correct 320 ms 14772 KB Output is correct
4 Correct 405 ms 14712 KB Output is correct
5 Correct 370 ms 14796 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 350 ms 12776 KB Output is correct
2 Correct 376 ms 13564 KB Output is correct
3 Correct 380 ms 16332 KB Output is correct
4 Correct 461 ms 16264 KB Output is correct
5 Correct 420 ms 16368 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 383 ms 12756 KB Output is correct
2 Correct 479 ms 12852 KB Output is correct
3 Correct 363 ms 12756 KB Output is correct
4 Correct 459 ms 16268 KB Output is correct
5 Correct 427 ms 16388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 423 ms 15956 KB Output is correct
2 Correct 473 ms 15956 KB Output is correct
3 Correct 463 ms 15956 KB Output is correct
4 Correct 563 ms 15956 KB Output is correct
5 Correct 519 ms 29672 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 476 ms 15916 KB Output is correct
2 Correct 590 ms 15904 KB Output is correct
3 Correct 467 ms 15956 KB Output is correct
4 Correct 567 ms 15956 KB Output is correct
5 Correct 533 ms 30716 KB Output is correct