답안 #115199

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
115199 2019-06-06T01:43:36 Z luciocf Mobile (BOI12_mobile) C++14
50 / 100
1000 ms 48596 KB
#include <bits/stdc++.h>
 
#define ff first
#define ss second
 
using namespace std;
 
const int maxn = 1e6+10;
const double inf = 1e9+10;
 
typedef pair<double, double> pt;
 
int n;
double L;
 
pt p[maxn];
 
double dist(pt a, pt b)
{
	double d1 = a.ff-b.ff;
	double d2 = a.ss-b.ss;
 
	return sqrt(d1*d1 + d2*d2);
}
 
bool ok(double K)
{
	vector<pt> V;
 
	for (int i = 1; i <= n; i++)
	{
		double x = p[i].ff, y = p[i].ss;
 
		if (K*K < y*y)
			continue;
 
		double delta = sqrt(K*K - y*y);
 
		double x1 = x-delta, x2 = x+delta;

		V.push_back({x1, x2});
	}

	sort(V.begin(), V.end());
 
	double r = 0.00;

	for (int i = 0; i < V.size(); i++)
		if (V[i].ff < r)
			r = max(r, V[i].ss);

	return (r <= L);
}
 
double busca(void)
{
	double ini = 0.00, fim = inf, ans = 0.00;
 
	for (int i = 1; i <= 60; i++)
	{
		double mid = (ini+fim)/2.00;
 
		if (ok(mid)) ans = mid, ini = mid;
		else fim = mid;
	}
 
	return ans;
}
 
int main(void)
{
	scanf("%d %lf\n", &n, &L);
 
	for (int i = 1; i <= n; i++)
		scanf("%lf %lf", &p[i].ff, &p[i].ss);
 
	printf("%.9lf\n", busca());
}

Compilation message

mobile.cpp: In function 'bool ok(double)':
mobile.cpp:48:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < V.size(); i++)
                  ~~^~~~~~~~~~
mobile.cpp: In function 'int main()':
mobile.cpp:72:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %lf\n", &n, &L);
  ~~~~~^~~~~~~~~~~~~~~~~~~~
mobile.cpp:75:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lf %lf", &p[i].ff, &p[i].ss);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 128 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 512 KB Output is correct
2 Correct 7 ms 512 KB Output is correct
3 Correct 4 ms 512 KB Output is correct
4 Correct 6 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 668 KB Output is correct
2 Correct 14 ms 808 KB Output is correct
3 Correct 19 ms 704 KB Output is correct
4 Correct 8 ms 736 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 700 KB Output is correct
2 Correct 15 ms 940 KB Output is correct
3 Correct 19 ms 736 KB Output is correct
4 Correct 8 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 668 KB Output is correct
2 Correct 14 ms 728 KB Output is correct
3 Correct 22 ms 752 KB Output is correct
4 Correct 8 ms 736 KB Output is correct
5 Correct 10 ms 704 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 142 ms 5072 KB Output is correct
2 Correct 349 ms 4992 KB Output is correct
3 Correct 223 ms 3416 KB Output is correct
4 Correct 98 ms 4912 KB Output is correct
5 Correct 90 ms 3288 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 154 ms 5284 KB Output is correct
2 Correct 123 ms 4896 KB Output is correct
3 Correct 127 ms 4992 KB Output is correct
4 Correct 102 ms 5012 KB Output is correct
5 Correct 94 ms 5248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 276 ms 5544 KB Output is correct
2 Correct 392 ms 5252 KB Output is correct
3 Correct 486 ms 5316 KB Output is correct
4 Correct 76 ms 5588 KB Output is correct
5 Correct 161 ms 6288 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 422 ms 5956 KB Output is correct
2 Correct 526 ms 5736 KB Output is correct
3 Correct 650 ms 5800 KB Output is correct
4 Correct 75 ms 5708 KB Output is correct
5 Correct 158 ms 5784 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 317 ms 5832 KB Output is correct
2 Correct 516 ms 5792 KB Output is correct
3 Correct 750 ms 5752 KB Output is correct
4 Correct 79 ms 5708 KB Output is correct
5 Correct 158 ms 6860 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1033 ms 24628 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1081 ms 24592 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1072 ms 36216 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1081 ms 35980 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1071 ms 39076 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1074 ms 39164 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1053 ms 42196 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1073 ms 42252 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1080 ms 48596 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1081 ms 48596 KB Time limit exceeded
2 Halted 0 ms 0 KB -