Submission #752859

# Submission time Handle Problem Language Result Execution time Memory
752859 2023-06-04T05:04:22 Z dubabuba Mobile (BOI12_mobile) C++14
0 / 100
1000 ms 56772 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;
	}
	cout << R << '\n';
	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 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 312 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 452 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 616 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 261 ms 5116 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 291 ms 4984 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 312 ms 5124 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 380 ms 6288 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 361 ms 6248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1073 ms 24560 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1070 ms 28524 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1081 ms 36164 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 40820 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1069 ms 39320 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 44912 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1074 ms 42456 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1072 ms 48744 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1069 ms 49056 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1064 ms 56772 KB Time limit exceeded
2 Halted 0 ms 0 KB -