QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#23331 | #2267. Jewelry Size | The_Nobody | TL | 2ms | 4256kb | C++14 | 1.5kb | 2022-03-15 13:17:41 | 2022-04-30 02:49:53 |
Judging History
answer
#include<bits/stdc++.h>
#define ll int
#define Il inline
#define Re register
#define mem(u,v) memset(u,v,sizeof(u))
#define rep(i,a,b) for(Re ll i=(a),KKK##i=(b);i<=KKK##i;i++)
#define drep(i,a,b) for(Re ll i=(a),KKK##i=(b);i>=KKK##i;i--)
#define go(u) for(ll i=head[u],v=e[i].to;i;i=e[i].nxt,v=e[i].to)
#define _go(u) for(ll i=Head[u],v=E[i].to;i;i=E[i].nxt,v=E[i].to)
#define __go(u) for(ll i=Head[u],v=e[i].to;i;i=e[i].nxt,v=e[i].to)
#define writesp(x) write(x),putchar(' ')
#define writeln(x) write(x),puts("")
using namespace std;
//#define getchar nc
inline char nc(){static char buf[10000000],*p1=buf,*p2=buf;return p1==p2&&(p2=(p1=buf)+fread(buf,1,10000000,stdin),p1==p2)?EOF:*p1++;}
Il ll read(){ll sum=0,f=0;char ch=getchar();for(;!isdigit(ch);ch=getchar())f|=(ch=='-');for(;isdigit(ch);ch=getchar())sum=((sum<<1)+(sum<<3)+(ch^48));return f?-sum:sum;}
void write(const ll x){if(x<0){putchar('-');write(-x);return;}if(x>9)write(x/10);putchar(x%10+'0');}
char getc(){char c=getchar();while(c!='*'&&c!='.')c=getchar();return c;}
#define N 1100
ll n,a[N],mx;double Pi=acos(-1),eps=1e-12;
bool pd(int f,double x){
double sum=0;
rep(i,1,n)sum+=asin(1.0*a[i]/(x*2));
// cout<<"DE"<<sum<<endl;
if(f)return sum-Pi>-eps;
return 2*asin(mx/(x*2))-sum>-eps;
}
double erf(int f){
double l=mx/2.0,r=1e10;
while(r-l>eps){
double mid=(l+r)/2;
// cout<<l<<' '<<r<<endl;
if(pd(f,mid))l=mid;
else r=mid;
}
return pd(f,l)?l:1e10;
}
int main(){
n=read();rep(i,1,n)a[i]=read(),mx=max(mx,a[i]);
printf("%.10lf",min(erf(1),erf(0)));
}
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 4036kb
input:
5 3 1 6 1 7
output:
3.5444043509
result:
ok found '3.5444044', expected '3.5444044', error '0.0000000'
Test #2:
score: 0
Accepted
time: 2ms
memory: 4256kb
input:
3 500 300 400
output:
250.0000000000
result:
ok found '250.0000000', expected '250.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3948kb
input:
8 2000 3000 4000 2000 3000 4000 2000 3000
output:
3780.9741206006
result:
ok found '3780.9741206', expected '3780.9741206', error '0.0000000'
Test #4:
score: 0
Accepted
time: 2ms
memory: 4144kb
input:
10 602 67 67 67 67 67 67 67 67 67
output:
3003.1398259425
result:
ok found '3003.1398259', expected '3003.1398170', error '0.0000000'
Test #5:
score: -100
Time Limit Exceeded
input:
1000 4719 3755 2542 1190 5557 3641 5426 1578 5247 3181 3524 983 4151 4337 3004 2062 1048 4739 499 2530 1378 450 5459 651 1714 4051 416 4186 2598 1031 374 5523 4787 1122 4919 2549 4763 4345 2333 4009 5732 5857 3198 3882 2399 4409 4151 3447 1353 4650 4184 2731 3307 3642 3383 5021 5899 2005 3206 702 30...