Submission #56212

# Submission time Handle Problem Language Result Execution time Memory
56212 2018-07-10T09:07:35 Z 김세빈(#1581) Mobile (BOI12_mobile) C++11
0 / 100
96 ms 600 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]) 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(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", ans);
	
	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 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 416 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 93 ms 524 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 96 ms 528 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 90 ms 528 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 528 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 528 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 528 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 528 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 528 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 528 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 600 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 600 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 600 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 600 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 600 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 600 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 600 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 600 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 600 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -