Submission #168852

# Submission time Handle Problem Language Result Execution time Memory
168852 2019-12-16T16:56:55 Z Uzumaki_Naturoo Mobile (BOI12_mobile) C++14
0 / 100
255 ms 8192 KB
/// I’m not gonna run away,
/// I never go back on my word!
/// That’s my nindo: my ninja way.
/// ICPC next year

#pragma GCC OPTIMIZE("03")
#include<bits/stdc++.h>
using namespace std ;
const int N = 1e6+5 ;
int n ,l ,x[N] ,y[N] ;
long double distance(long double x1,long double y1,long double x2,long double y2){
    return 1ll*(x2-x1)*(x2-x1) + 1ll*(y2-y1)*(y2-y1) ;
}
int main(){
    scanf("%d%d",&n,&l);
    for(int i=0;i<n;++i) scanf("%d%d",x+i,y+i);
    long double best1 = -1e18 ,best2 = -1e18 ;
    int p1 = 0 ,p2 = 0 ;
    for(int i=0;i<n;++i){
        long double d = distance(0,0,x[i],y[i]);
        if(d>best1) best1 = d ,p1 = i ;
        d = distance(l,0,x[i],y[i]);
        if(d>best2) best2 = d ,p2 = i ;
    }
    long long a = 1ll*x[p1]*x[p1] - 1ll*x[p2]*x[p2] + 1ll*y[p1]*y[p1] - 1ll*y[p2]*y[p2] ;
    long long b = 2ll * (x[p1] - x[p2]) ;
    long double x0 = 1.0 * a / b ;
    long double ans = 0 ;
    for(int i=0;i<n;++i) ans = max(ans ,distance(x0,0,x[i],y[i]));
    cout << fixed << setprecision(6) << sqrtl(ans) << endl ;
    return 0;
}

Compilation message

mobile.cpp:6:0: warning: ignoring #pragma GCC OPTIMIZE [-Wunknown-pragmas]
 #pragma GCC OPTIMIZE("03")
 
mobile.cpp: In function 'int main()':
mobile.cpp:15:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&l);
     ~~~~~^~~~~~~~~~~~~~
mobile.cpp:16:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=0;i<n;++i) scanf("%d%d",x+i,y+i);
                          ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 888 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 988 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 1016 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 1144 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 1168 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 98 ms 4216 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 130 ms 4356 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 117 ms 4984 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 155 ms 4988 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 137 ms 5868 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 180 ms 5752 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 156 ms 6632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 205 ms 6520 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 196 ms 8192 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 255 ms 8180 KB Output isn't correct
2 Halted 0 ms 0 KB -