QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#377737#3994. Easy Jumphl666WA 1ms4064kbC++171.6kb2024-04-05 17:08:482024-04-05 17:08:49

Judging History

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

  • [2024-04-05 17:08:49]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4064kb
  • [2024-04-05 17:08:48]
  • 提交

answer

#include<cstdio>
#include<iostream>
#include<cmath>
#define double long double
#define RI register int
#define CI const int&
using namespace std;
const int N=1005;
const double INF=1e18;
int n,H,S,p[N],k,x,T1,T2,st[N]; double P[N];
namespace Case1
{
	double f[N][10];
	inline void solve(void)
	{
		for (RI i=n,j;i>=1;--i) for (j=2;j<=H;++j)
		if (j>2) f[i][j]=1.0+f[i+1][j]*P[i]+f[i][j-1]*(1.0-P[i]);
		else f[i][j]=(1.0+f[i+1][j]*P[i]+T2*(1.0-P[i]))/P[i];
		printf("%.12Lf",f[1][H]);
	}
};
namespace Case2
{
	double f[N][10][10];
	inline void solve(void)
	{
		for (RI i=n,j,k,x;i>=1;--i)
		{
			if (st[i])
			{
				for (j=2;j<=H;++j) for (f[i][j][S]=INF,x=0;x<=H;++x)
				{
					if (j+x>H) continue;
					for (k=0;k<=S;++k)
					{
						if (st[i+1]&&k!=S) continue;
						if (j>2) f[i][j][S]=min(f[i][j][S],1.0+(f[i+1][j+x][k]+T1*x)*P[i]+f[i][j-1][S]*(1.0-P[i]));
						else f[i][j][S]=min(f[i][j][S],(1.0+(f[i+1][j+x][k]+T1*x)*P[i]+T1*(1.0-P[i]))/P[i]);
					}
				}
			} else
			{
				for (j=2;j<=H;++j) for (k=0;k<=S;++k)
				{
					if (j>2) { f[i][j][k]=1.0+f[i+1][j][k]*P[i]+f[i][j-1][k]*(1.0-P[i]); continue; }
					if (k>0) f[i][j][k]=1.0+f[i+1][j][k]*P[i]+(f[i][j][k-1]+T1)*(1.0-P[i]);
					else f[i][j][k]=(1.0+f[i+1][j][k]*P[i]+T2*(1.0-P[i]))/P[i];
				}
			}
		}
		printf("%.12Lf",f[1][H][S]);
	}
};
int main()
{
	RI i; for (scanf("%d%d%d",&n,&H,&S),i=1;i<=n;++i)
	scanf("%d",&p[i]),P[i]=1.0*p[i]/100.0;
	for (scanf("%d",&k),i=1;i<=k;++i) scanf("%d",&x),st[x]=1;
	scanf("%d%d",&T1,&T2);
	if (S==0||T2<=T1) Case1::solve(); else Case2::solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3872kb

input:

1 2 0
50
0
1 2

output:

4.000000000000

result:

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

Test #2:

score: 0
Accepted
time: 1ms
memory: 3892kb

input:

2 3 1
50 50
1 1
1 3

output:

6.000000000000

result:

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

Test #3:

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

input:

1 6 4
75
0
64 6

output:

1.341145833333

result:

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

Test #4:

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

input:

1 5 1
61
1 1
15 43

output:

2.208223196721

result:

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

Test #5:

score: 0
Accepted
time: 1ms
memory: 3876kb

input:

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

output:

942.414842012843

result:

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

Test #6:

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

input:

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

output:

401.866862981977

result:

ok found '401.8668630', expected '401.8668630', error '0.0000000'

Test #7:

score: -100
Wrong Answer
time: 1ms
memory: 4064kb

input:

100 3 5
85 59 20 75 58 42 79 95 22 15 95 81 69 73 45 42 99 93 58 8 18 34 88 14 23 37 87 16 96 17 40 58 32 26 93 9 37 15 68 49 99 73 48 79 16 27 52 4 66 53 48 55 27 56 52 66 25 30 34 11 97 20 38 30 4 78 17 98 4 23 30 71 87 94 89 71 45 92 72 24 90 24 78 48 62 82 30 30 27 55 64 66 41 72 53 97 59 38 80 ...

output:

262.379915742117

result:

wrong answer 1st numbers differ - expected: '13395.8550625', found: '262.3799157', error = '0.9804134'