Submission #168834

# Submission time Handle Problem Language Result Execution time Memory
168834 2019-12-16T16:16:10 Z MohamedAhmed04 Mobile (BOI12_mobile) C++14
90 / 100
1000 ms 8436 KB
#include <bits/stdc++.h>
 
using namespace std ;
 
const int MAX = 1e6 + 10 ;
int x[MAX] , y[MAX] ;
int n , l;
double a , b , now;
 
bool check(double radius)
{
	now = 0.00 ;
	for(int i = 0 ; i < n ; ++i)
	{
		a = sqrt(radius * radius - ((-y[i] * 1ll) * (-y[i] * 1ll))) + x[i] * 1ll ;
		b = -sqrt(radius * radius - ((-y[i] * 1ll) * (-y[i] * 1ll))) + x[i] * 1ll ;
		if(a > b)
			swap(a , b) ;
		if(a <= now)
			now = max(now , b) ; 
	}
	return (now >= l) ;
}
 
int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	scanf("%d %d" , &n , &l) ;
	for(int i = 0 ; i < n ; ++i)
		scanf("%d %d" , &x[i] , &y[i]) ;
	double low = 0.000 , high = 1e9 ;
	double ans = high ;
	for(int i = 0 ; i < 43 ; ++i)
	{
		double mid = (low + high) / 2.00 ;
		if(check(mid))
			ans = mid , high = mid ;
		else
			low = mid ;
	}
	return printf("%.6lf\n" , ans) , 0 ;
}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:29:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d" , &n , &l) ;
  ~~~~~^~~~~~~~~~~~~~~~~~~
mobile.cpp:31:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d" , &x[i] , &y[i]) ;
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 6 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 6 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 432 KB Output is correct
4 Correct 7 ms 376 KB Output is correct
5 Correct 6 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 61 ms 1016 KB Output is correct
2 Correct 49 ms 1016 KB Output is correct
3 Correct 37 ms 760 KB Output is correct
4 Correct 71 ms 1016 KB Output is correct
5 Correct 38 ms 760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 62 ms 884 KB Output is correct
2 Correct 60 ms 988 KB Output is correct
3 Correct 71 ms 1036 KB Output is correct
4 Correct 74 ms 1016 KB Output is correct
5 Correct 85 ms 1016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 52 ms 1016 KB Output is correct
2 Correct 53 ms 1060 KB Output is correct
3 Correct 58 ms 1060 KB Output is correct
4 Correct 103 ms 1144 KB Output is correct
5 Correct 73 ms 1272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 65 ms 1144 KB Output is correct
2 Correct 64 ms 1096 KB Output is correct
3 Correct 68 ms 1144 KB Output is correct
4 Correct 107 ms 1144 KB Output is correct
5 Correct 93 ms 1144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 66 ms 1148 KB Output is correct
2 Correct 64 ms 1224 KB Output is correct
3 Correct 65 ms 1116 KB Output is correct
4 Correct 103 ms 1144 KB Output is correct
5 Correct 88 ms 1144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 289 ms 4316 KB Output is correct
2 Correct 314 ms 4216 KB Output is correct
3 Correct 311 ms 4216 KB Output is correct
4 Correct 506 ms 4356 KB Output is correct
5 Correct 438 ms 4552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 317 ms 4292 KB Output is correct
2 Correct 430 ms 4316 KB Output is correct
3 Correct 326 ms 4344 KB Output is correct
4 Correct 497 ms 4216 KB Output is correct
5 Correct 450 ms 4216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 344 ms 5096 KB Output is correct
2 Correct 376 ms 5112 KB Output is correct
3 Correct 372 ms 5128 KB Output is correct
4 Correct 614 ms 5088 KB Output is correct
5 Correct 519 ms 5100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 382 ms 5200 KB Output is correct
2 Correct 511 ms 5088 KB Output is correct
3 Correct 391 ms 5128 KB Output is correct
4 Correct 612 ms 5112 KB Output is correct
5 Correct 543 ms 5112 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 402 ms 5876 KB Output is correct
2 Correct 442 ms 5912 KB Output is correct
3 Correct 434 ms 5780 KB Output is correct
4 Correct 708 ms 5872 KB Output is correct
5 Correct 599 ms 5964 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 441 ms 5904 KB Output is correct
2 Correct 591 ms 5912 KB Output is correct
3 Correct 459 ms 6000 KB Output is correct
4 Correct 707 ms 6008 KB Output is correct
5 Correct 626 ms 5880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 457 ms 6660 KB Output is correct
2 Correct 500 ms 6792 KB Output is correct
3 Correct 495 ms 6716 KB Output is correct
4 Correct 814 ms 6904 KB Output is correct
5 Correct 711 ms 6776 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 502 ms 6648 KB Output is correct
2 Correct 673 ms 6780 KB Output is correct
3 Correct 522 ms 6776 KB Output is correct
4 Correct 809 ms 6760 KB Output is correct
5 Correct 721 ms 6596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 571 ms 8304 KB Output is correct
2 Correct 624 ms 8284 KB Output is correct
3 Correct 618 ms 8184 KB Output is correct
4 Execution timed out 1008 ms 8328 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 628 ms 8180 KB Output is correct
2 Correct 838 ms 8436 KB Output is correct
3 Correct 659 ms 8248 KB Output is correct
4 Execution timed out 1014 ms 8312 KB Time limit exceeded
5 Halted 0 ms 0 KB -