QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#88512#2878. Journey in Fog2024zllWA 0ms1732kbC++14951b2023-03-16 14:00:222023-03-16 14:00:25

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-16 14:00:25]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 1732kb
  • [2023-03-16 14:00:22]
  • Submitted

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'