Submission #639138

# Submission time Handle Problem Language Result Execution time Memory
639138 2022-09-08T17:20:25 Z luanaamorim Mobile (BOI12_mobile) C++14
14 / 100
755 ms 23920 KB
#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring>
#include <set>
#include <stack>
#include <bitset>
#define dbug(x) cout << (#x) << " -> " << x << endl
#define ll long long
#define INF (2e9 + 5)
#define MAX (int) (2e6 + 5)
#define MOD 1000000007
#define par pair<int, int>
#define all(v) v.begin(), v.end()
#define sz(x) (int) ((x).size())
#define esq(x) (x<<1)
#define dir(x) ((x<<1)|1)
#define lsb(x) (x & -x)
#define W(x) cout << #x << ": " << x << endl
#define Wii(x) cout << x.first << ' ' << x.second << endl
#define _ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ERR 1e-9

using namespace std;

double l, n, a[MAX], b[MAX];

int check(double raio)
{
	double fim = 0;
	for (int i = 0; i < n; i++)
	{
		if (raio < b[i]) continue;
		double prox_fim = a[i] + (sqrt((raio*raio) - (b[i]*b[i])));
		double prox_ini = a[i] - (sqrt((raio*raio) - (b[i]*b[i])));
		if (prox_ini <= fim) fim = max(prox_fim, fim);
	}

	return (fim >= l);
}

int main()
{_
	cin >> n >> l;
	for (int i = 0; i < n; i++)
		cin >> a[i] >> b[i];

	int cnt = 40;
	double meio, ini = 0, fim = INF;
	while (cnt--)
	{
		meio = (ini+fim)/2;
		if (check(meio)) fim = meio;
		else ini = meio;
	}

	cout << fixed << setprecision(6) << fim << endl;
}















# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 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 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 4 ms 420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Incorrect 5 ms 340 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 4 ms 340 KB Output is correct
3 Incorrect 4 ms 340 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 51 ms 1496 KB Output is correct
2 Correct 44 ms 1444 KB Output is correct
3 Incorrect 26 ms 1100 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 43 ms 1544 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 1676 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 73 ms 1772 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 71 ms 1948 KB Output is correct
2 Incorrect 57 ms 1820 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 272 ms 8096 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 314 ms 8156 KB Output is correct
2 Incorrect 334 ms 8248 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 296 ms 9676 KB Output is correct
2 Incorrect 371 ms 9676 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 373 ms 9676 KB Output is correct
2 Correct 395 ms 9696 KB Output is correct
3 Incorrect 297 ms 9680 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 344 ms 11240 KB Output is correct
2 Correct 424 ms 11448 KB Output is correct
3 Incorrect 410 ms 11312 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 497 ms 11356 KB Output is correct
2 Correct 424 ms 11212 KB Output is correct
3 Correct 385 ms 11288 KB Output is correct
4 Correct 630 ms 11272 KB Output is correct
5 Correct 599 ms 21400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 386 ms 12840 KB Output is correct
2 Correct 490 ms 12776 KB Output is correct
3 Correct 467 ms 12876 KB Output is correct
4 Correct 755 ms 12876 KB Output is correct
5 Correct 623 ms 23920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 518 ms 12900 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 486 ms 15976 KB Output is correct
2 Incorrect 611 ms 15948 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 674 ms 16084 KB Output isn't correct
2 Halted 0 ms 0 KB -