# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
56128 | 2018-07-10T05:13:14 Z | 정원준(#1583) | Mobile (BOI12_mobile) | C++11 | 60 ms | 3160 KB |
#include <bits/stdc++.h> #define L long long using namespace std; L n,l; struct S{ L x,y; }a[100010]; bool operator<(S a,S b){ if(a.x==b.x) return a.y<b.y; return a.x<b.x; } S st[100010]; L top; double cross(S a,S b){ return (double)(b.x*b.x-a.x*a.x+ b.y*b.y-a.y*a.y)/(2*(b.x-a.x)); } bool shellpop(S temp){ if(top<2) return 0; double cross1=cross(st[top],st[top-1]); top++; st[top]=temp; double cross2=cross(st[top],st[top-1]); top--; return cross2<cross1; } double ab(double x){ return x>0?x:-x; } double ans; int main() { scanf("%lld %lld",&n,&l); L i; for(i=1;i<=n;i++) { scanf("%lld %lld",&a[i].x,&a[i].y); if(a[i].y<0) a[i].y*=-1; } sort(a+1,a+n+1); for(i=1;i<=n;i++) { if(i<n&&a[i].x==a[i+1].x) continue; if(top<2) { top++; st[top]=a[i]; } else { while(shellpop(a[i])) top--; top++; st[top]=a[i]; } } if(top==1) { printf("%lf",max(sqrt(st[1].x*st[1].x+st[1].y*st[1].x),sqrt((st[1].x-l)*(st[1].x-l)+st[1].y*st[1].y))); return 0; } /*for(i=1;i<=top;i++) { printf("%lld %lld\n",st[i].x,st[i].y); }*/ for(i=1;i<top;i++) { double temp=cross(st[i+1],st[i]); double temp2=sqrt((st[i].x-temp)*(st[i].x-temp)+st[i].y*st[i].y); double temp3=sqrt((st[i+1].x-temp)*(st[i+1].x-temp)+st[i+1].y*st[i+1].y); if(ab(temp2-temp3)>0.01) while(1); ans=max(ans,temp2); //printf("%lf %lf %lf\n",temp,temp2,temp3); } double mi=1e12; for(i=1;i<=n;i++) { mi=min(mi,sqrt(st[i].x*st[i].x+st[i].y*st[i].x)); } ans=max(ans,mi); mi=1e12; for(i=1;i<=n;i++) { mi=min(mi,sqrt((st[i].x-l)*(st[i].x-l)+st[i].y*st[i].x)); } ans=max(ans,mi); printf("%lf",ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 412 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 668 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 668 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 668 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 25 ms | 1664 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 29 ms | 1664 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 32 ms | 3160 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 35 ms | 3160 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 60 ms | 3160 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 21 ms | 3160 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 39 ms | 3160 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 24 ms | 3160 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 33 ms | 3160 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 25 ms | 3160 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 34 ms | 3160 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 24 ms | 3160 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 32 ms | 3160 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 21 ms | 3160 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 41 ms | 3160 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |