Submission #638432

# Submission time Handle Problem Language Result Execution time Memory
638432 2022-09-06T00:37:57 Z LeticiaFCS Mobile (BOI12_mobile) C++17
90 / 100
1000 ms 35340 KB
#include "bits/stdc++.h"
#define st first
#define nd second
using lint = int64_t;
constexpr int MOD = int(1e9) + 7;
constexpr int INF = 0x3f3f3f3f;
constexpr int NINF = 0xcfcfcfcf;
constexpr lint LINF = 0x3f3f3f3f3f3f3f3f;
const long double PI = acosl(-1.0);
// Returns -1 if a < b, 0 if a = b and 1 if a > b.
int cmp_double(double a, double b = 0, double eps = 1e-9) {
	return a + eps > b ? b + eps > a ? 0 : 1 : -1;
}
using namespace std;

using ld = long double;

int main() {
	cin.tie(nullptr)->sync_with_stdio(false);
	int n;
	lint length;
	cin>>n>>length;
	vector<lint> x(n), y(n);
	for(int i=0; i<n; i++)
		cin>>x[i]>>y[i];
	
	ld l = 0, r = length;
	int it = 45;
	while(it--){
		ld mid = (l+r)/2;
		ld lastX = 0;
		for(int i=0; i<n; i++){
			ld xaux = sqrtl(mid*mid - y[i]*y[i]);
			ld a = x[i] - xaux;
			ld b = x[i] + xaux;
			if(a <= lastX + 1e-9)
				lastX = max(lastX, b);
		}
				
		if(length <= lastX + 1e-9) r = mid;
		else l = mid;
	}
	cout<<fixed<<setprecision(5)<<r<<"\n";
	

	return 0;
}
/*
[  ]Leu o problema certo???
[  ]Ver se precisa de long long
[  ]Viu o limite dos fors (é n? é m?)
[  ]Tamanho do vetor, será que é 2e5 em vez de 1e5??
[  ]Testar sample
[  ]Testar casos de  borda
[  ]1LL no 1LL << i
[  ]Testar mod (é 1e9+7, mesmo?, será que o mod não ficou negativo?)
*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 324 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 340 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Correct 5 ms 340 KB Output is correct
4 Correct 6 ms 456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 340 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 7 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 3 ms 456 KB Output is correct
3 Correct 3 ms 436 KB Output is correct
4 Correct 5 ms 468 KB Output is correct
5 Correct 5 ms 440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 82 ms 1876 KB Output is correct
2 Correct 30 ms 1748 KB Output is correct
3 Correct 27 ms 1364 KB Output is correct
4 Correct 102 ms 1748 KB Output is correct
5 Correct 46 ms 1356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 84 ms 1900 KB Output is correct
2 Correct 69 ms 1620 KB Output is correct
3 Correct 83 ms 1840 KB Output is correct
4 Correct 78 ms 1772 KB Output is correct
5 Correct 90 ms 1932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 31 ms 1876 KB Output is correct
2 Correct 29 ms 1748 KB Output is correct
3 Correct 42 ms 1876 KB Output is correct
4 Correct 128 ms 2132 KB Output is correct
5 Correct 85 ms 1964 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 2256 KB Output is correct
2 Correct 45 ms 2132 KB Output is correct
3 Correct 54 ms 2140 KB Output is correct
4 Correct 100 ms 2132 KB Output is correct
5 Correct 101 ms 2140 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 38 ms 2260 KB Output is correct
2 Correct 41 ms 2132 KB Output is correct
3 Correct 72 ms 2144 KB Output is correct
4 Correct 102 ms 2132 KB Output is correct
5 Correct 96 ms 2136 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 188 ms 8528 KB Output is correct
2 Correct 179 ms 8392 KB Output is correct
3 Correct 180 ms 8400 KB Output is correct
4 Correct 531 ms 8404 KB Output is correct
5 Correct 540 ms 8532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 195 ms 8536 KB Output is correct
2 Correct 482 ms 8400 KB Output is correct
3 Correct 254 ms 13900 KB Output is correct
4 Correct 516 ms 17604 KB Output is correct
5 Correct 496 ms 15456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 225 ms 10060 KB Output is correct
2 Correct 215 ms 9968 KB Output is correct
3 Correct 235 ms 9964 KB Output is correct
4 Correct 612 ms 9968 KB Output is correct
5 Correct 594 ms 17612 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 216 ms 9972 KB Output is correct
2 Correct 540 ms 9864 KB Output is correct
3 Correct 316 ms 16716 KB Output is correct
4 Correct 609 ms 21476 KB Output is correct
5 Correct 586 ms 18436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 280 ms 11664 KB Output is correct
2 Correct 255 ms 11664 KB Output is correct
3 Correct 249 ms 11660 KB Output is correct
4 Correct 778 ms 11660 KB Output is correct
5 Correct 683 ms 20356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 250 ms 11604 KB Output is correct
2 Correct 615 ms 11476 KB Output is correct
3 Correct 363 ms 19668 KB Output is correct
4 Correct 782 ms 24588 KB Output is correct
5 Correct 692 ms 21324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 286 ms 13224 KB Output is correct
2 Correct 290 ms 13224 KB Output is correct
3 Correct 289 ms 13224 KB Output is correct
4 Correct 810 ms 13220 KB Output is correct
5 Correct 795 ms 24016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 298 ms 13236 KB Output is correct
2 Correct 712 ms 13224 KB Output is correct
3 Correct 391 ms 22364 KB Output is correct
4 Correct 827 ms 28328 KB Output is correct
5 Correct 791 ms 24444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 344 ms 16372 KB Output is correct
2 Correct 387 ms 16484 KB Output is correct
3 Correct 380 ms 16484 KB Output is correct
4 Execution timed out 1000 ms 15988 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 382 ms 15956 KB Output is correct
2 Correct 920 ms 16616 KB Output is correct
3 Correct 539 ms 28276 KB Output is correct
4 Execution timed out 1022 ms 35340 KB Time limit exceeded
5 Halted 0 ms 0 KB -