QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#210292#3994. Easy Jumpsumi007WA 1ms5996kbC++142.2kb2023-10-11 10:59:182023-10-11 10:59:19

Judging History

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

  • [2023-10-11 10:59:19]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5996kb
  • [2023-10-11 10:59:18]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define i64 __int128
#define ll long long
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define lowbit(i) i&(-i)
const int N = 2077; 
const double inf = 1e18;
int n,H,S,T2,T1,sp[N];
double p[N],f[N][10][10],g[N][N],h[N];
void solve1(){
    for(int i=1;i<=n;i++){
        for(int j=1;j<=H;j++){
            g[i][j] = inf;
        }
    }
    for(int i=n;i>=1;i--){
        for(int j=1;j<=H;j++){
            if(j==1){
                g[i][j] = (g[i+1][1]*p[i]+(1-p[i])*T2+1)/p[i];
            }else{
                g[i][j] = p[i]*g[i+1][j]+(1-p[i])*g[i][j-1]+1;
            }
        }
    }
    cout << g[1][H] << '\n';
}
int main(){
    cin.tie(0),cout.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(12);
    cin >> n >> H >> S;H--;
    for(int i=1;i<=n;i++) cin >> p[i],p[i] /= 100;
    for(int i=1,x;i<=n;i++){
        cin >> x;
        sp[x] = 1;
    }
    cin >> T1 >> T2;
    if(T2<=T1 || !S){
        solve1();
        exit(0);
    }
    for(int i=1;i<=n;i++) for(int j=1;j<=H;j++) for(int k=0;k<=S;k++) f[i][j][k] = inf;
    for(int i=n;i>=1;i--){ 
        if(!sp[i]){  
            for(int j=1;j<=H;j++){
                for(int k=0;k<=S;k++){
                    if(j==1){
                        if(k) f[i][j][k] = (p[i]*f[i+1][j][k]+(1-p[i])*(f[i][j][k-1]+T1)+1);
                        else f[i][j][k] = (p[i]*f[i+1][j][k]+(1-p[i])*T2+1)/p[i];
                    }else{
                        f[i][j][k] = p[i]*f[i+1][j][k]+(1-p[i])*f[i][j-1][k]+1;
                    }
                }
            }
        }else{
            for(int l=1;l<H;l++){
                h[l] = (p[i]*f[i+1][l][S]+(1-p[i])*T1+1)/p[i];
                for(int t=l-1;t>=1;t--) h[t] = h[t+1]+T1;
                for(int t=l+1;t<=H;t++) h[t] = p[i]*f[i+1][t][S]+(1-p[i])*(h[t-1])+1;
                for(int t=1;t<=H;t++) f[i][t][S] = min(f[i][t][S],h[t]); 
            }
            for(int j=1;j<=H;j++){
                for(int k=S-1;k>=0;k--){
                    f[i][j][k] = min(f[i][j][k],f[i][j][k+1]);
                }
            }
        }
    }
    cout << f[1][H][S] << '\n';
    return 0;
}

詳細信息

Test #1:

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

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: 5980kb

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: 3944kb

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: -100
Wrong Answer
time: 0ms
memory: 5996kb

input:

1 5 1
61
1 1
15 43

output:

1.677269524590

result:

wrong answer 1st numbers differ - expected: '2.2082232', found: '1.6772695', error = '0.2404438'