Submission #374759

# Submission time Handle Problem Language Result Execution time Memory
374759 2021-03-08T05:54:58 Z wzy Mobile (BOI12_mobile) C++17
0 / 100
1000 ms 9324 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
int n , L;
pair<int,int> v[N];

double f(double mid){
	double cur = 0.00;
	for(int i = 1 ; i <= n; i ++){
		double len = sqrt(mid*mid - (1.00 * v[i].second) * (1.00 * v[i].second));
		if(cur < (1.00*v[i].first - len))
			return 0;
		cur = max(cur , 1.00*v[i].first + len);
	}
	return cur >= L;
}

int32_t main(){
	scanf("%d%d" , &n , &L);
	for(int i = 1; i <= n; i ++){
		scanf("%d%d" , &v[i].first , &v[i].second);
	}
	sort(v + 1 , v + 1 + n);
	double l = 0.000 , r = 1e12;
	while(r-l > 1e-9){
		double mid = l + (r-l)/2;
		if(f(mid))
			r = mid;
		else
			l = mid;
	}
	printf("%.6lF" , l);
}

Compilation message

mobile.cpp: In function 'int32_t main()':
mobile.cpp:19:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   19 |  scanf("%d%d" , &n , &L);
      |  ~~~~~^~~~~~~~~~~~~~~~~~
mobile.cpp:21:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   21 |   scanf("%d%d" , &v[i].first , &v[i].second);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 364 KB Output is correct
2 Execution timed out 1068 ms 364 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 53 ms 1132 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 49 ms 1132 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 45 ms 1260 KB Output is correct
2 Execution timed out 1083 ms 2156 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1049 ms 1536 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 52 ms 1388 KB Output is correct
2 Execution timed out 1085 ms 2540 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1052 ms 4608 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 4460 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1051 ms 5228 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1096 ms 5356 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 6636 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 6508 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1071 ms 7452 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 7404 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 8940 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1076 ms 9324 KB Time limit exceeded
2 Halted 0 ms 0 KB -