# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
96432 | easrui | Mobile (BOI12_mobile) | C++14 | 4 ms | 524 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int MN = 1e6+5;
int N,L,C[MN],num[MN],cur,pos;
long long X[MN],Y[MN],A[MN],B[MN];
long double Ipos[MN],x,ans,tmp;
bool cmp(int a, int b)
{
if(A[a]==A[b]) return B[a]<B[b];
return A[a]>A[b];
}
long double getI(int a, int b)
{
if(A[a]==A[b]) return L;
return (long double)(B[a]-B[b])/(A[b]-A[a]);
}
int main()
{
ios_base::sync_with_stdio(0),cin.tie(0);
freopen("C:\\Users\\user\\Downloads\\mobile_tests\\mobile.i03d","r",stdin);
cin >> N >> L;
for(int i=0; i<N; i++){
cin >> X[i] >> Y[i];
A[i] = X[i]*(-2);
B[i] = X[i]*X[i]+Y[i]*Y[i];
num[i] = i;
}
sort(num,num+N,cmp);
Ipos[pos] = 0;
C[pos] = num[0];
for(int i=1; i<N; i++){
cur = num[i];
while(1){
if(pos==-1){
Ipos[++pos] = 0;
C[pos] = cur;
break;
}
x = getI(C[pos],cur);
if(x>=L) break;
if(x>Ipos[pos]){
Ipos[++pos] = x;
C[pos] = cur;
break;
}
pos--;
}
}
Ipos[pos+1] = L;
for(int i=0; i<=pos; i++){
cur = C[i];
tmp = max((Ipos[i]-X[cur])*(Ipos[i]-X[cur]),(Ipos[i+1]-X[cur])*(Ipos[i+1]-X[cur]))+Y[cur]*Y[cur];
ans = max(ans,tmp);
}
cout << fixed;
cout.precision(4);
cout << sqrt(ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |