Submission #168828

# Submission time Handle Problem Language Result Execution time Memory
168828 2019-12-16T15:51:06 Z MohamedAhmed04 Mobile (BOI12_mobile) C++14
90 / 100
1000 ms 8336 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 = 1e10 ;
	double ans = high ;
	for(int i = 0 ; i < 50 ; ++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 376 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 504 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 4 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 4 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 7 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 7 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 376 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 69 ms 1016 KB Output is correct
2 Correct 54 ms 996 KB Output is correct
3 Correct 41 ms 764 KB Output is correct
4 Correct 78 ms 888 KB Output is correct
5 Correct 42 ms 788 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 1000 KB Output is correct
2 Correct 67 ms 888 KB Output is correct
3 Correct 78 ms 1016 KB Output is correct
4 Correct 82 ms 1016 KB Output is correct
5 Correct 92 ms 1156 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 57 ms 1020 KB Output is correct
2 Correct 58 ms 1016 KB Output is correct
3 Correct 62 ms 1064 KB Output is correct
4 Correct 112 ms 1272 KB Output is correct
5 Correct 81 ms 1016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 74 ms 1144 KB Output is correct
2 Correct 75 ms 1144 KB Output is correct
3 Correct 73 ms 1144 KB Output is correct
4 Correct 112 ms 1144 KB Output is correct
5 Correct 97 ms 1272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 72 ms 1144 KB Output is correct
2 Correct 70 ms 1148 KB Output is correct
3 Correct 72 ms 1176 KB Output is correct
4 Correct 112 ms 1116 KB Output is correct
5 Correct 97 ms 1144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 318 ms 4320 KB Output is correct
2 Correct 344 ms 4472 KB Output is correct
3 Correct 343 ms 4320 KB Output is correct
4 Correct 549 ms 4340 KB Output is correct
5 Correct 483 ms 4344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 348 ms 4344 KB Output is correct
2 Correct 477 ms 4312 KB Output is correct
3 Correct 368 ms 4344 KB Output is correct
4 Correct 548 ms 4308 KB Output is correct
5 Correct 501 ms 4344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 382 ms 5084 KB Output is correct
2 Correct 411 ms 5220 KB Output is correct
3 Correct 410 ms 5208 KB Output is correct
4 Correct 668 ms 5092 KB Output is correct
5 Correct 574 ms 5240 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 415 ms 5112 KB Output is correct
2 Correct 566 ms 5180 KB Output is correct
3 Correct 432 ms 5112 KB Output is correct
4 Correct 665 ms 5096 KB Output is correct
5 Correct 594 ms 5092 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 444 ms 5880 KB Output is correct
2 Correct 484 ms 5880 KB Output is correct
3 Correct 478 ms 5912 KB Output is correct
4 Correct 772 ms 6008 KB Output is correct
5 Correct 668 ms 5872 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 485 ms 5880 KB Output is correct
2 Correct 656 ms 5852 KB Output is correct
3 Correct 507 ms 6008 KB Output is correct
4 Correct 766 ms 6008 KB Output is correct
5 Correct 692 ms 6008 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 514 ms 6740 KB Output is correct
2 Correct 552 ms 6656 KB Output is correct
3 Correct 547 ms 6652 KB Output is correct
4 Correct 887 ms 6808 KB Output is correct
5 Correct 776 ms 6776 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 556 ms 6656 KB Output is correct
2 Correct 755 ms 6668 KB Output is correct
3 Correct 581 ms 6648 KB Output is correct
4 Correct 881 ms 6640 KB Output is correct
5 Correct 795 ms 6648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 633 ms 8320 KB Output is correct
2 Correct 686 ms 8312 KB Output is correct
3 Correct 686 ms 8336 KB Output is correct
4 Execution timed out 1083 ms 8184 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 690 ms 8312 KB Output is correct
2 Correct 926 ms 8184 KB Output is correct
3 Correct 729 ms 8312 KB Output is correct
4 Execution timed out 1079 ms 8184 KB Time limit exceeded
5 Halted 0 ms 0 KB -