Submission #321581

# Submission time Handle Problem Language Result Execution time Memory
321581 2020-11-12T19:38:36 Z CSQ31 Mobile (BOI12_mobile) C++14
50 / 100
1000 ms 71752 KB
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define sz(a) (int)(a.size())
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define MOD (ll)(1e9+9)
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
ll gcd(ll a,ll b){if(!b)return a;else return gcd(b,a%b);}
int main()
{
	int n;
	cin>>n;
	ld L;cin>>L;
	vector<ld>x(n),y(n);
	for(int i=0;i<n;i++){
		cin>>x[i]>>y[i];
	}
	ld l = 1,r = 1e9+2;
	while(r-l>1e-4){
		ld mid = (l+r)/2;
		vector<ld>lf(n),rg(n);
		for(int i=0;i<n;i++){
			if(y[i] > mid){
				lf[i] = 1e9+1;
				rg[i] = -1e9;
				continue;
			}
			ld dist = sqrt(mid*mid - y[i]*y[i]);
			lf[i] = x[i]-dist;
			rg[i] = x[i]+dist;
		}
		ld cur = 0;
		for(int i=0;i<n;i++){
			if(cur >=lf[i])cur=max(cur,rg[i]);
		}
		if(cur >= L)r=mid;
		else l=mid;
	}
	cout<<fixed<<setprecision(4)<<l;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 492 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 492 KB Output is correct
2 Correct 7 ms 492 KB Output is correct
3 Correct 5 ms 492 KB Output is correct
4 Correct 7 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 728 KB Output is correct
2 Correct 18 ms 752 KB Output is correct
3 Correct 12 ms 748 KB Output is correct
4 Correct 15 ms 756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 732 KB Output is correct
2 Correct 14 ms 752 KB Output is correct
3 Correct 12 ms 724 KB Output is correct
4 Correct 21 ms 756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 736 KB Output is correct
2 Correct 14 ms 752 KB Output is correct
3 Correct 12 ms 724 KB Output is correct
4 Correct 16 ms 764 KB Output is correct
5 Correct 13 ms 716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 222 ms 5956 KB Output is correct
2 Correct 233 ms 6328 KB Output is correct
3 Correct 153 ms 4424 KB Output is correct
4 Correct 263 ms 6336 KB Output is correct
5 Correct 146 ms 4176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 243 ms 6204 KB Output is correct
2 Correct 240 ms 5768 KB Output is correct
3 Correct 282 ms 6536 KB Output is correct
4 Correct 280 ms 6680 KB Output is correct
5 Correct 319 ms 7328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 251 ms 6708 KB Output is correct
2 Correct 252 ms 6788 KB Output is correct
3 Correct 246 ms 6752 KB Output is correct
4 Correct 378 ms 8692 KB Output is correct
5 Correct 289 ms 7048 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 316 ms 8248 KB Output is correct
2 Correct 307 ms 8380 KB Output is correct
3 Correct 286 ms 7812 KB Output is correct
4 Correct 380 ms 8636 KB Output is correct
5 Correct 343 ms 8180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 319 ms 8216 KB Output is correct
2 Correct 315 ms 8108 KB Output is correct
3 Correct 286 ms 7812 KB Output is correct
4 Correct 390 ms 8664 KB Output is correct
5 Correct 343 ms 8144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 36148 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1047 ms 40156 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 43348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1057 ms 48144 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1100 ms 50424 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1101 ms 55800 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1098 ms 57692 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1103 ms 63664 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1095 ms 71752 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 46588 KB Time limit exceeded
2 Halted 0 ms 0 KB -