Submission #964111

# Submission time Handle Problem Language Result Execution time Memory
964111 2024-04-16T10:38:07 Z dubabuba Mobile (BOI12_mobile) C++14
0 / 100
1000 ms 55432 KB
#include <bits/stdc++.h>
using namespace std;
 
typedef pair<int, int> pii;
#define x first
#define y second
#define MP make_pair
 
const int mxn = 1e6 + 10;
pii P[mxn];
int n, l;
 
bool can(double r) {
	vector<pair<double, double>> v;
	for(int i = 1; i <= n; i++) {
		pii &p = P[i];
		double X = p.x;
		double Y = p.y;
 
		double sq = r * r - Y * Y;
		if(sq < 0) continue;
		sq = sqrt(sq);
 
		double f = X - sq, s = X + sq;
		if(f < 0) f = 0;
		if(s < 0) s = 0;
		if(f != s) v.push_back(MP(f, s));
	}
 
	sort(v.begin(), v.end());
	for(int i = 1; i < v.size(); i++) {
		if(v[i - 1].second < v[i].first) {
			if(v[i].first > 0.0) return 1;
			if(v[i - 1].second < (double) l) return 1;
		}
	}
	return 0;
}
 
int main() {
	cin >> n >> l;
	for(int i = 1; i <= n; i++)
		cin >> P[i].x >> P[i].y;
 
	double L = 0, R = 1e18;
	while(R - L > 0.0000001) {
		double M = (L + R) / 2;
		if(can(M)) L = M;
		else R = M;
	}
	printf("%.6lf\n", L);
	return 0;
}

Compilation message

mobile.cpp: In function 'bool can(double)':
mobile.cpp:31:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<double, double> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |  for(int i = 1; i < v.size(); i++) {
      |                 ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 704 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 860 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 696 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 211 ms 5936 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 252 ms 6860 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 277 ms 6620 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 311 ms 6508 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 301 ms 6344 KB Output is correct
2 Incorrect 302 ms 6324 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1039 ms 24244 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1028 ms 27308 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1045 ms 39956 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1053 ms 41652 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1060 ms 41304 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1062 ms 45636 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1039 ms 42272 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1055 ms 47372 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1016 ms 48048 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 55432 KB Time limit exceeded
2 Halted 0 ms 0 KB -