Submission #321591

# Submission time Handle Problem Language Result Execution time Memory
321591 2020-11-12T19:58:03 Z CSQ31 Mobile (BOI12_mobile) C++14
95 / 100
753 ms 30828 KB
#pragma GCC optimize("Ofast") 
#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()
{
	owo
	int n,L;
	cin>>n>>L;
	vector<ll>x(n),y(n);
	for(int i=0;i<n;i++){
		cin>>x[i]>>y[i];
	}
	double l = 1,r = L;
	while(r-l>1e-3){
		double mid = (l+r)/2;
		double cur = 0;
		for(int i=0;i<n;i++){
			double lf,rg;
			if(y[i] > mid){lf=1e9+5;rg=-1e9;}
			else {double dist = sqrt(mid*mid - y[i]*y[i]);
			      lf = x[i]-dist;
			      rg = x[i]+dist;
			  }
			if(cur >=lf)cur=max(cur,rg);
		}
		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 0 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 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 0 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 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 2 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 364 KB Output is correct
2 Correct 3 ms 364 KB Output is correct
3 Correct 2 ms 364 KB Output is correct
4 Correct 3 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 364 KB Output is correct
2 Correct 2 ms 364 KB Output is correct
3 Correct 2 ms 364 KB Output is correct
4 Correct 3 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 364 KB Output is correct
2 Correct 2 ms 364 KB Output is correct
3 Correct 2 ms 364 KB Output is correct
4 Correct 3 ms 364 KB Output is correct
5 Correct 2 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 1516 KB Output is correct
2 Correct 35 ms 1516 KB Output is correct
3 Correct 17 ms 1132 KB Output is correct
4 Correct 48 ms 1516 KB Output is correct
5 Correct 16 ms 1132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 1516 KB Output is correct
2 Correct 36 ms 1388 KB Output is correct
3 Correct 46 ms 1644 KB Output is correct
4 Correct 48 ms 1516 KB Output is correct
5 Correct 57 ms 1644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 1644 KB Output is correct
2 Correct 34 ms 1644 KB Output is correct
3 Correct 27 ms 1644 KB Output is correct
4 Correct 73 ms 2028 KB Output is correct
5 Correct 43 ms 1772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 46 ms 1900 KB Output is correct
2 Correct 42 ms 2028 KB Output is correct
3 Correct 29 ms 1900 KB Output is correct
4 Correct 73 ms 1900 KB Output is correct
5 Correct 57 ms 1900 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 45 ms 1900 KB Output is correct
2 Correct 41 ms 1900 KB Output is correct
3 Incorrect 30 ms 1900 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 193 ms 8172 KB Output is correct
2 Correct 212 ms 8172 KB Output is correct
3 Correct 197 ms 8172 KB Output is correct
4 Correct 363 ms 8224 KB Output is correct
5 Correct 282 ms 8224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 227 ms 8224 KB Output is correct
2 Correct 235 ms 8300 KB Output is correct
3 Correct 155 ms 8172 KB Output is correct
4 Correct 353 ms 8172 KB Output is correct
5 Correct 293 ms 8172 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 240 ms 9836 KB Output is correct
2 Correct 262 ms 9964 KB Output is correct
3 Correct 233 ms 9708 KB Output is correct
4 Correct 444 ms 9836 KB Output is correct
5 Correct 340 ms 9708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 274 ms 9784 KB Output is correct
2 Correct 281 ms 9836 KB Output is correct
3 Correct 185 ms 9708 KB Output is correct
4 Correct 442 ms 9836 KB Output is correct
5 Correct 359 ms 9836 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 280 ms 11244 KB Output is correct
2 Correct 303 ms 11244 KB Output is correct
3 Correct 281 ms 11372 KB Output is correct
4 Correct 511 ms 11372 KB Output is correct
5 Correct 380 ms 11372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 324 ms 11372 KB Output is correct
2 Correct 321 ms 11372 KB Output is correct
3 Correct 224 ms 11372 KB Output is correct
4 Correct 510 ms 11372 KB Output is correct
5 Correct 427 ms 11244 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 313 ms 13036 KB Output is correct
2 Correct 343 ms 12920 KB Output is correct
3 Correct 327 ms 13036 KB Output is correct
4 Correct 583 ms 13036 KB Output is correct
5 Correct 459 ms 24172 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 367 ms 12908 KB Output is correct
2 Correct 347 ms 13036 KB Output is correct
3 Correct 251 ms 13036 KB Output is correct
4 Correct 588 ms 12920 KB Output is correct
5 Correct 482 ms 24584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 391 ms 16052 KB Output is correct
2 Correct 467 ms 16052 KB Output is correct
3 Correct 416 ms 16052 KB Output is correct
4 Correct 753 ms 16108 KB Output is correct
5 Correct 578 ms 29804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 456 ms 16052 KB Output is correct
2 Correct 433 ms 15980 KB Output is correct
3 Correct 330 ms 16108 KB Output is correct
4 Correct 724 ms 16052 KB Output is correct
5 Correct 601 ms 30828 KB Output is correct