Submission #56216

# Submission time Handle Problem Language Result Execution time Memory
56216 2018-07-10T09:13:23 Z 김세빈(#1581) Mobile (BOI12_mobile) C++11
25 / 100
110 ms 748 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

ll X[5050], Y[5050];
ll n, d;
double ans, maxv;

double dist(ll p, double x)
{
	return sqrt((X[p] - x) * (X[p] - x) + Y[p] * Y[p]);
}

int main()
{
	double l, r, x;
	ll i, j;
	
	scanf("%lld%lld", &n, &d);
	
	if(n > 5000) return 0;
	
	for(i=0;i<n;i++){
		scanf("%lld%lld", X+i, Y+i);
		if(Y[i] < 0) Y[i] = -Y[i];
	}
	
	for(i=0;i<n;i++){
		l = 0, r = d;
		for(j=0;j<n;j++){
			if(X[i] == X[j]){
				if(Y[j] < Y[i]) break;
				else continue;
			}
			x = (X[i] * X[i] - X[j] * X[j] + Y[i] * Y[i] - Y[j] * Y[j]) / 2.0 / (X[i] - X[j]);
			
			if(X[i] < X[j]) r = min(r, x);
			else l = max(l, x);
		}
		if(j < n || l > r) continue;
		
		if(maxv < dist(i, l)) ans = l, maxv = dist(i, l);
		if(maxv < dist(i, r)) ans = r, maxv = dist(i, r);
	}
	
	printf("%.12lf\n", maxv);
	
	return 0;
}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:21:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld%lld", &n, &d);
  ~~~~~^~~~~~~~~~~~~~~~~~~~
mobile.cpp:26:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld%lld", X+i, Y+i);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 2 ms 484 KB Output is correct
3 Correct 3 ms 484 KB Output is correct
4 Correct 2 ms 484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 544 KB Output is correct
2 Correct 3 ms 544 KB Output is correct
3 Correct 3 ms 544 KB Output is correct
4 Correct 3 ms 544 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 616 KB Output is correct
2 Correct 29 ms 744 KB Output is correct
3 Correct 15 ms 744 KB Output is correct
4 Correct 21 ms 744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 77 ms 744 KB Output is correct
2 Correct 84 ms 744 KB Output is correct
3 Correct 96 ms 744 KB Output is correct
4 Correct 110 ms 744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 81 ms 744 KB Output is correct
2 Correct 95 ms 744 KB Output is correct
3 Correct 46 ms 744 KB Output is correct
4 Correct 82 ms 748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 96 ms 748 KB Output is correct
2 Correct 100 ms 748 KB Output is correct
3 Correct 50 ms 748 KB Output is correct
4 Correct 96 ms 748 KB Output is correct
5 Correct 49 ms 748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 748 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 748 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 748 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 748 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 748 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 748 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 748 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 748 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 748 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 748 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 748 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 748 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 748 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 748 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 748 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -