QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#616139 | #2267. Jewelry Size | asdfsdf# | TL | 74ms | 3972kb | C++23 | 1.1kb | 2024-10-05 22:45:27 | 2024-10-05 22:45:27 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define MAX 1010101
#define PI 3.1415926535897943383
int X[MAX];
typedef long double ld;
signed main() {
ios::sync_with_stdio(false), cin.tie(0);
int N;
cin>>N;
int i;
int mx = 0;
for(i=1;i<=N;i++) cin>>X[i],mx = max(mx, X[i]);
ld l, r;
l = mx;
l*=0.5;
r= 1e8;
int T = 200000;
while(T--){
ld m = l+r;
m/=2.0;
//cout<<l<<' '<<r<<'\n';
ld t=0;
for(i=1;i<=N;i++) {
t += asin(X[i]/(2*m));
}
if(t<PI) r=m;
else l=m;
}
ld t=0;
for(i=1;i<=N;i++) {
t += asin(X[i]/(2*l));
}
if(t+1e-9<PI) {
l*=0.5;
r= 1e8;
sort(X+1, X+N+1);
int T = 200000;
while(T--){
ld m = l+r;
m/=2.0;
//cout<<l<<' '<<r<<'\n';
ld t=0;
for(i=1;i<N;i++) {
t += asin(X[i]/(2*m));
}
if(t<asin(X[N]/(2*m))) l=m;
else r=m;
}
}
cout<<fixed;
cout.precision(20);
cout<<l;
}
详细
Test #1:
score: 100
Accepted
time: 24ms
memory: 3796kb
input:
5 3 1 6 1 7
output:
3.54440435091866091533
result:
ok found '3.5444044', expected '3.5444044', error '0.0000000'
Test #2:
score: 0
Accepted
time: 19ms
memory: 3972kb
input:
3 500 300 400
output:
250.00000000000000000000
result:
ok found '250.0000000', expected '250.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 36ms
memory: 3868kb
input:
8 2000 3000 4000 2000 3000 4000 2000 3000
output:
3780.97412059948717355518
result:
ok found '3780.9741206', expected '3780.9741206', error '0.0000000'
Test #4:
score: 0
Accepted
time: 74ms
memory: 3924kb
input:
10 602 67 67 67 67 67 67 67 67 67
output:
3003.13981696529173226473
result:
ok found '3003.1398170', 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...