답안 #96433

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
96433 2019-02-09T12:52:27 Z easrui Mobile (BOI12_mobile) C++14
100 / 100
356 ms 63744 KB
#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);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 4 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 632 KB Output is correct
2 Correct 3 ms 760 KB Output is correct
3 Correct 3 ms 760 KB Output is correct
4 Correct 4 ms 632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 632 KB Output is correct
2 Correct 3 ms 632 KB Output is correct
3 Correct 3 ms 632 KB Output is correct
4 Correct 3 ms 632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 636 KB Output is correct
2 Correct 3 ms 632 KB Output is correct
3 Correct 3 ms 632 KB Output is correct
4 Correct 3 ms 632 KB Output is correct
5 Correct 3 ms 632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 3836 KB Output is correct
2 Correct 23 ms 4216 KB Output is correct
3 Correct 15 ms 2936 KB Output is correct
4 Correct 24 ms 4220 KB Output is correct
5 Correct 14 ms 2552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 3960 KB Output is correct
2 Correct 22 ms 3704 KB Output is correct
3 Correct 26 ms 4216 KB Output is correct
4 Correct 25 ms 4344 KB Output is correct
5 Correct 30 ms 4984 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 5880 KB Output is correct
2 Correct 25 ms 4508 KB Output is correct
3 Correct 26 ms 5112 KB Output is correct
4 Correct 39 ms 5880 KB Output is correct
5 Correct 26 ms 4472 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 5496 KB Output is correct
2 Correct 31 ms 5312 KB Output is correct
3 Correct 27 ms 5112 KB Output is correct
4 Correct 34 ms 5916 KB Output is correct
5 Correct 29 ms 5240 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 5880 KB Output is correct
2 Correct 31 ms 5340 KB Output is correct
3 Correct 27 ms 5112 KB Output is correct
4 Correct 34 ms 5880 KB Output is correct
5 Correct 29 ms 5244 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 138 ms 32120 KB Output is correct
2 Correct 152 ms 25844 KB Output is correct
3 Correct 195 ms 25208 KB Output is correct
4 Correct 170 ms 27668 KB Output is correct
5 Correct 155 ms 24952 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 182 ms 26152 KB Output is correct
2 Correct 154 ms 25052 KB Output is correct
3 Correct 136 ms 24652 KB Output is correct
4 Correct 161 ms 27460 KB Output is correct
5 Correct 152 ms 25356 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 159 ms 38428 KB Output is correct
2 Correct 183 ms 30884 KB Output is correct
3 Correct 182 ms 30200 KB Output is correct
4 Correct 203 ms 33472 KB Output is correct
5 Correct 178 ms 29476 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 190 ms 31352 KB Output is correct
2 Correct 178 ms 29920 KB Output is correct
3 Correct 174 ms 29048 KB Output is correct
4 Correct 212 ms 33400 KB Output is correct
5 Correct 185 ms 30200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 185 ms 44920 KB Output is correct
2 Correct 246 ms 36104 KB Output is correct
3 Correct 245 ms 35320 KB Output is correct
4 Correct 267 ms 38676 KB Output is correct
5 Correct 213 ms 34248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 219 ms 36576 KB Output is correct
2 Correct 200 ms 34808 KB Output is correct
3 Correct 192 ms 34636 KB Output is correct
4 Correct 248 ms 38692 KB Output is correct
5 Correct 211 ms 35204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 228 ms 51256 KB Output is correct
2 Correct 256 ms 40960 KB Output is correct
3 Correct 239 ms 40360 KB Output is correct
4 Correct 279 ms 44312 KB Output is correct
5 Correct 253 ms 39808 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 251 ms 41876 KB Output is correct
2 Correct 230 ms 39700 KB Output is correct
3 Correct 218 ms 39288 KB Output is correct
4 Correct 285 ms 44024 KB Output is correct
5 Correct 242 ms 40164 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 265 ms 63744 KB Output is correct
2 Correct 310 ms 51192 KB Output is correct
3 Correct 308 ms 50228 KB Output is correct
4 Correct 342 ms 54960 KB Output is correct
5 Correct 303 ms 49144 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 356 ms 52088 KB Output is correct
2 Correct 285 ms 49400 KB Output is correct
3 Correct 305 ms 49400 KB Output is correct
4 Correct 333 ms 55028 KB Output is correct
5 Correct 339 ms 50424 KB Output is correct