Submission #752861

# Submission time Handle Problem Language Result Execution time Memory
752861 2023-06-04T05:05:42 Z dubabuba Mobile (BOI12_mobile) C++14
0 / 100
1000 ms 40248 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)
			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 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 568 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 564 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 608 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 254 ms 4196 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 292 ms 4216 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 315 ms 4568 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 371 ms 4780 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 366 ms 4812 KB Output is correct
2 Incorrect 361 ms 6276 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1072 ms 20384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1063 ms 20436 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 31012 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1073 ms 30976 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1062 ms 33448 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 33264 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 35580 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 35536 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1078 ms 40248 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1078 ms 40240 KB Time limit exceeded
2 Halted 0 ms 0 KB -