QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#194825#3994. Easy JumpkkioWA 1ms3968kbC++171.9kb2023-09-30 22:46:422023-09-30 22:46:43

Judging History

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

  • [2023-09-30 22:46:43]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3968kb
  • [2023-09-30 22:46:42]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int maxn=1e3+10;
int n,H,S,k;
double f[maxn][15][15],g[maxn][15],p[maxn],q[maxn],T1,T2;
bool tag[maxn];
int main()
{
    cin>>n>>H>>S;
    for(int i=1;i<=n;i++)cin>>p[i],p[i]/=100;
    cin>>k;
    for(int i=1,x;i<=k;i++)
    {
        cin>>x;
        tag[x]=1;
    }
    cin>>T1>>T2;
    if(T1>=T2)
    {
        for(int i=n;i>=1;i--)
        {
            g[i][2]=(1.0+g[i+1][2]*p[i]+(1-p[i])*T2)/p[i];
            for(int j=3;j<=H;j++)g[i][j]=(1+p[i]*g[i+1][j]+(1-p[i])*g[i][j-1]);
        }
        cout<<fixed<<setprecision(7)<<g[1][H]<<endl;
    }
    else 
    {
        double ans=1e18;
        for(int L=2;L<=H;L++)
        {
            for(int i=n;i>=1;i--)
            {
                if(!tag[i])
                {
                    for(int j=2;j<=H;j++)
                        for(int k=0;k<=S;k++)
                        {
                            if(j==2&&k==0)f[i][j][k]=(1+p[i]*f[i+1][j][k]+(1-p[i])*T2)/p[i];
                            else if(j==2&&k)f[i][j][k]=1+p[i]*f[i+1][j][k]+(1-p[i])*(f[i][j][k-1]+T1);
                            else if(j>2)f[i][j][k]=1+p[i]*f[i+1][j][k]+(1-p[i])*f[i][j-1][k];
                        }
                }
                else
                {
                    for(int j=L;j<=H;j++)
                    {
                        if(j==L)f[i][j][S]=(1+p[i]*f[i+1][j][S]+(1-p[i])*(S==0?T2:T1))/p[i];
                        else f[i][j][S]=1+p[i]*f[i+1][j][S]+(1-p[i])*f[i][j-1][S];
                    }
                    for(int j=2;j<L;j++)
                        f[i][j][S]=f[i][L][S]+(L-j)*(S==0?T2:T1);
                    for(int j=2;j<=H;j++)
                        for(int k=0;k<S;k++)
                            f[i][j][k]=f[i][j][S];
                }
            }
            ans=min(ans,f[1][H][S]);
        }
        cout<<fixed<<setprecision(7)<<ans<<endl;
    }
}

詳細信息

Test #1:

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

input:

1 2 0
50
0
1 2

output:

4.0000000

result:

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

Test #2:

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

input:

2 3 1
50 50
1 1
1 3

output:

6.0000000

result:

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

Test #3:

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

input:

1 6 4
75
0
64 6

output:

1.3411458

result:

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

Test #4:

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

input:

1 5 1
61
1 1
15 43

output:

2.2082232

result:

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

Test #5:

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

input:

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

output:

942.4148420

result:

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

Test #6:

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

input:

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

output:

401.8668630

result:

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

Test #7:

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

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:

13430.9559451

result:

wrong answer 1st numbers differ - expected: '13395.8550625', found: '13430.9559451', error = '0.0026203'