QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#88512 | #2878. Journey in Fog | 2024zll | WA | 0ms | 1732kb | C++14 | 951b | 2023-03-16 14:00:22 | 2023-03-16 14:00:25 |
Judging History
answer
#include<algorithm>
#include<cstdio>
namespace IO{
const int ARR_SIZE=1<<20;
#define gc() ((IO::si!=IO::ti||(IO::ti=(IO::si=IO::input)+fread(IO::input,1,IO::ARR_SIZE,stdin))),IO::si!=IO::ti?*(IO::si++):EOF)
char input[ARR_SIZE],*si=input,*ti=input;
template<typename T>
void read(T&num){
int ch=gc();
num=0;
while(ch<48||ch>57)ch=gc();
while(ch>=48&&ch<=57)num=(num<<3)+(num<<1)+(ch^48),ch=gc();
}
}
using IO::read;
typedef double real;
const int maxn=10000000;
int n,L,V,v[maxn+1];
real K,B,pre,l,r,ans=1e308;
int main(){
read(n),read(L),read(V);
for(int i=1;i<=n;i++)read(v[i]);
for(int i=1;i<=n;i++){
K+=1-2.0*v[i]/(v[i]+V);
B+=2.0*L/(v[i]+V);
}
for(int i=n;i>=1;i--){
r=L/v[i];
if(K>=0)ans=std::min(ans,K*l+B+pre);
else ans=std::min(ans,K*r+B+pre);
K-=1-2.0*v[i]/(v[i]+V);
B-=2.0*L/(v[i]+V);
pre+=L/v[i],l=r;
}
ans=std::min(ans,pre);
printf("%.10lf\n",ans/n);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 1568kb
input:
1 1000 30 10
output:
50.0000000000
result:
ok found '50.000000000', expected '50.000000000', error '0.000000000'
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 1732kb
input:
1 1000 10 30
output:
33.0000000000
result:
wrong answer 1st numbers differ - expected: '33.3333333', found: '33.0000000', error = '0.0100000'