Submission #638430

# Submission time Handle Problem Language Result Execution time Memory
638430 2022-09-06T00:35:37 Z LeticiaFCS Mobile (BOI12_mobile) C++17
50 / 100
1000 ms 21580 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 = 300;
	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 1 ms 328 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 340 KB Output is correct
2 Correct 5 ms 340 KB Output is correct
3 Correct 12 ms 340 KB Output is correct
4 Correct 4 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 420 KB Output is correct
2 Correct 7 ms 340 KB Output is correct
3 Correct 14 ms 340 KB Output is correct
4 Correct 29 ms 448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 340 KB Output is correct
2 Correct 7 ms 468 KB Output is correct
3 Correct 14 ms 340 KB Output is correct
4 Correct 28 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 340 KB Output is correct
2 Correct 7 ms 464 KB Output is correct
3 Correct 13 ms 436 KB Output is correct
4 Correct 30 ms 468 KB Output is correct
5 Correct 28 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 471 ms 2004 KB Output is correct
2 Correct 102 ms 2596 KB Output is correct
3 Correct 136 ms 1748 KB Output is correct
4 Correct 435 ms 2764 KB Output is correct
5 Correct 270 ms 1492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 450 ms 2180 KB Output is correct
2 Correct 399 ms 2132 KB Output is correct
3 Correct 450 ms 2740 KB Output is correct
4 Correct 431 ms 2760 KB Output is correct
5 Correct 473 ms 3152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 135 ms 2132 KB Output is correct
2 Correct 113 ms 2764 KB Output is correct
3 Correct 210 ms 2516 KB Output is correct
4 Correct 557 ms 3824 KB Output is correct
5 Correct 490 ms 2508 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 162 ms 2392 KB Output is correct
2 Correct 129 ms 3292 KB Output is correct
3 Correct 241 ms 2908 KB Output is correct
4 Correct 548 ms 3904 KB Output is correct
5 Correct 540 ms 3156 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 159 ms 2388 KB Output is correct
2 Correct 131 ms 3300 KB Output is correct
3 Correct 252 ms 2920 KB Output is correct
4 Correct 548 ms 3916 KB Output is correct
5 Correct 548 ms 3156 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 766 ms 8660 KB Output is correct
2 Correct 654 ms 15816 KB Output is correct
3 Correct 776 ms 15372 KB Output is correct
4 Execution timed out 1064 ms 17620 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 663 ms 8668 KB Output is correct
2 Execution timed out 1074 ms 14664 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 918 ms 10220 KB Output is correct
2 Correct 940 ms 19020 KB Output is correct
3 Correct 926 ms 18380 KB Output is correct
4 Execution timed out 1067 ms 21580 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 815 ms 10216 KB Output is correct
2 Execution timed out 1073 ms 17612 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 11788 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 929 ms 11796 KB Output is correct
2 Execution timed out 1067 ms 20616 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1078 ms 13256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1083 ms 13268 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 16456 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1083 ms 15956 KB Time limit exceeded
2 Halted 0 ms 0 KB -