QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#208876#3994. Easy JumpISYRHHWA 0ms1692kbC++141.8kb2023-10-09 21:39:072023-10-09 21:39:08

Judging History

你现在查看的是最新测评结果

  • [2023-10-09 21:39:08]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:1692kb
  • [2023-10-09 21:39:07]
  • 提交

answer

#include<cstdio>
using namespace std;
double p[1010],dp0[1010][10],p0[1010][10],dp1[1010][10],p1[1010][10],dp2[1010],p2[1010];
int n,h,s,m,in,t1,t2;
bool vis[1010];
int main()
{
	scanf("%d%d%d",&n,&h,&s);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&in);
		p[i]=in/100.0;
	}
	scanf("%d",&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d",&in);
		vis[in]=true;
	}
	scanf("%d%d",&t1,&t2);
	if(t1>t2)t1=t2;
	p0[1][h]=1;
	for(int i=1;i<=n;i++)
	{
		for(int j=h;j>=2;j--)
		{
			dp0[i+1][j]+=(dp0[i][j]+p0[i][j])*p[i];
			p0[i+1][j]+=p0[i][j]*p[i];
			p0[i][j-1]+=p0[i][j]*(1-p[i]);
			dp0[i][j-1]+=(dp0[i][j]+p0[i][j])*(1-p[i]);
		}
		if(s>1)
		{
			dp1[i][s-1]+=dp0[i][1]+p0[i][1]*t1;
			p1[i][s-1]+=p0[i][1];
		}
		else if(s)
		{
			dp2[i]+=dp0[i][1]+p0[i][1]*t1;
			p2[i]+=p0[i][1];
		}
		else
		{
			dp2[i]+=dp0[i][1]+p0[i][1]*t2;
			p2[i]+=p0[i][1];
		}
		if(vis[i])
		{
			double tp=0,td=0;
			for(int j=s;j;j--)
			{
				tp+=p1[i][j];
				td+=dp1[i][j];
			}
			tp+=p2[i];td+=dp2[i];
			if(s)
			{
				dp1[i+1][s]+=tp*((t1+1)/p[i]*(1-p[i])+1)+td;
				p1[i+1][s]+=tp;
			}
			else
			{
				dp2[i]+=tp*((t1+1)/p[i]*(1-p[i])+1)+td;
				p2[i]+=tp;
			}
		}
		else
		{
			for(int j=s;j>1;j--)
			{
				dp1[i+1][j-1]+=(dp1[i][j]+p1[i][j])*p[i];
				p1[i+1][j-1]+=p1[i][j]*p[i];
				dp1[i][j-1]+=(dp1[i][j]+p1[i][j]*(t1+1))*(1-p[i]);
				p1[i][j-1]+=p1[i][j]*(1-p[i]);
			}
			dp2[i+1]+=(dp1[i][1]+p1[i][1])*p[i];
			p2[i+1]+=p1[i][1]*p[i];
			dp2[i]+=(dp1[i][1]+p1[i][1]*(t1+1))*(1-p[i]);
			p2[i]+=p1[i][1]*(1-p[i]);
			dp2[i+1]+=dp2[i]+p2[i]*(1+(1-p[i])*(t2+1)/p[i]);
			p2[i+1]+=p2[i];
		}
	}
	double res=0;
	for(int j=h;j>=2;j--)
	{
		res+=dp0[n+1][j];
	}
	for(int j=s;j;j--)
	{
		res+=dp1[n+1][j];
	}
	res+=dp2[n+1];
	printf("%.10f",res);
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 1652kb

input:

1 2 0
50
0
1 2

output:

4.0000000000

result:

ok found '4.0000000', expected '4.0000000', error '0.0000000'

Test #2:

score: 0
Accepted
time: 0ms
memory: 1660kb

input:

2 3 1
50 50
1 1
1 3

output:

6.0000000000

result:

ok found '6.0000000', expected '6.0000000', error '0.0000000'

Test #3:

score: 0
Accepted
time: 0ms
memory: 1632kb

input:

1 6 4
75
0
64 6

output:

1.3411458333

result:

ok found '1.3411458', expected '1.3411458', error '0.0000000'

Test #4:

score: 0
Accepted
time: 0ms
memory: 1692kb

input:

1 5 1
61
1 1
15 43

output:

2.2082231967

result:

ok found '2.2082232', expected '2.2082232', error '0.0000000'

Test #5:

score: 0
Accepted
time: 0ms
memory: 1664kb

input:

10 9 3
12 65 76 33 17 20 89 16 4 63
3 2 4 8
73 21

output:

942.4148420128

result:

ok found '942.4148420', expected '942.4148420', error '0.0000000'

Test #6:

score: -100
Wrong Answer
time: 0ms
memory: 1596kb

input:

10 6 0
26 6 29 76 92 46 8 4 91 44
1 4
17 6

output:

20.5561615676

result:

wrong answer 1st numbers differ - expected: '401.8668630', found: '20.5561616', error = '0.9488483'