Submission #56211

# Submission time Handle Problem Language Result Execution time Memory
56211 2018-07-10T09:03:52 Z 김세빈(#1581) Mobile (BOI12_mobile) C++11
0 / 100
153 ms 672 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);
	
	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(l <= X[i] && X[i] <= r){
			if(maxv < Y[i]) ans = X[i], maxv = Y[i];
		}
		else{
			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:24: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 3 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 484 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 121 ms 572 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 133 ms 572 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 153 ms 668 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4 ms 668 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5 ms 668 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4 ms 672 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6 ms 672 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5 ms 672 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5 ms 672 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4 ms 672 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5 ms 672 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4 ms 672 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6 ms 672 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 0 ms 672 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4 ms 672 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4 ms 672 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4 ms 672 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4 ms 672 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -