QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#357500#3994. Easy JumpChrysanthBlossomWA 1ms3948kbC++141.7kb2024-03-18 21:57:452024-03-18 21:57:46

Judging History

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

  • [2024-03-18 21:57:46]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3948kb
  • [2024-03-18 21:57:45]
  • 提交

answer

#include<bits/stdc++.h>
#define ri register int
#define ll long long
#define ld long double
using namespace std;
const int maxn=1e3+7;
ld f[maxn][10][10];
int n,S,H;
int k;
int T1,T2;
ld p[maxn];
bool hv[maxn];
const ld inf=1e16;
void solve(){
	for(ri i=n;i;i--){
		for(ri j=1;j<H;j++){
			for(ri k=0;k<=S;k++){
				if(j==1){
					f[i][j][k]=(1+p[i]*f[i+1][j][k]+(1-p[i])*T2)/p[i];
				}
				else{
					f[i][j][k]=(1+p[i]*f[i+1][j][k]+(1-p[i])*f[i][j-1][k]);
				}
			}
		}
	}
	cout<<f[1][H][S]<<endl;
	exit(0);
}
signed main(){
	ios::sync_with_stdio(0);
	cin>>n>>H>>S;
	for(ri i=1;i<=n;i++){
		cin>>p[i];
		p[i]/=100;
	}
	cin>>k;
	for(ri i=1;i<=k;i++){
		int t;cin>>t;
		hv[t]=1;
	}
	cin>>T1>>T2;
	for(ri i=1;i<=n;i++){
		for(ri j=0;j<=H;j++){
			for(ri k=0;k<=S;k++){
				f[i][j][k]=inf;
			}
		}
	}
	if(T1>=T2)solve();
	for(ri i=n;i;i--){
		if(!S||!hv[i]){
			for(ri j=1;j<H;j++){
				for(ri k=0;k<=S;k++){
					if(j>=2){
						f[i][j][k]=(1+p[i]*f[i+1][j][k]+(1-p[i])*f[i][j-1][k]);
					}
					else if(k>=1){
						f[i][j][k]=(1+p[i]*f[i+1][j][k]+(1-p[i])*(T1+f[i][j][k-1]));
					}
					else{
						f[i][j][k]=(1+p[i]*f[i+1][j][k]+(1-p[i])*T2)/p[i];
					}
				}
			}
		}
		else{
			for(ri j=1;j<H;j++){
				f[i][j][S]=(1+f[i+1][j][S]*p[i]+(1-p[i])*T1)/p[i];
				for(ri now=1;now<j;now++){
					f[i][now][S]=min(f[i][now][S],f[i][j][S]+T1*(j-now));
				}
			}
		}
	}
//	for(ri i=1;i<=n;i++){
//		for(ri j=1;j<H;j++){
//			for(ri k=0;k<=S;k++){
//				cout<<f[i][j][k]<<' ';
//			} cout<<endl;
//		}
//		cout<<"------------------------------\n";
//	}
	cout<<f[1][H-1][S];
	return 0;
}
/*
1 2 0
50
0
1 2

*/

详细

Test #1:

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

input:

1 2 0
50
0
1 2

output:

4

result:

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

Test #2:

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

input:

2 3 1
50 50
1 1
1 3

output:

6

result:

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

Test #3:

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

input:

1 6 4
75
0
64 6

output:

1e+16

result:

wrong answer 1st numbers differ - expected: '1.3411458', found: '10000000000000000.0000000', error = '7456310679613502.0000000'