QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#77488#3994. Easy JumpchenshiWA 2ms3812kbC++1.3kb2023-02-14 20:43:252023-02-14 20:43:29

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-14 20:43:29]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3812kb
  • [2023-02-14 20:43:25]
  • 提交

answer

#include<cstdio>
#include<iostream>
using namespace std;
const int o=1010;const long double inf=1e18;
int n,h,s,K;long double T1,T2,T2_,p[o],f[o][10][7],v,t;bool tote[o];
int main(){
	scanf("%d%d%d",&n,&h,&s);
	for(int i=1;i<=n;++i) scanf("%Lf",&p[i]),p[i]/=100;
	scanf("%d",&K);
	for(int a;K--;tote[a]=1) scanf("%d",&a);
	scanf("%Lf%Lf",&T1,&T2);
	for(int i=n;i;--i){
		for(int k=0;k<=s;++k) for(int j=2;j<=h;++j){
			v=1+p[i]*f[i+1][j][k];t=inf;T2_=T2;
			if(j>2) t=min(t,f[i][j-1][k]);
			if(k) t=min(t,f[i][j][k-1]+T1);
			if(tote[i]) v=1+p[i]*f[i+1][j][s],T2_=min(T1,T2);
			f[i][j][k]=min(v+(1-p[i])*t,(v+(1-p[i])*T2_)/p[i]);
			for(int $=1;$<=k&&j+$<=h;++$) f[i][j][k]=min(f[i][j][k],f[i][j+$][k-$]+T1*$);
		}
		if(!tote[i]) continue;
		for(int T=10;T--;){
			for(int k=0;k<=s;++k) for(int j=2;j<=h;++j){
				v=1+p[i]*f[i+1][j][k];t=inf;T2_=T2;
				if(j>2) t=min(t,f[i][j-1][k]);
				if(k) t=min(t,f[i][j][k-1]+T1);
				if(tote[i]) v=1+p[i]*f[i+1][j][s],T2_=min(T1,T2);
				f[i][j][k]=min(v+(1-p[i])*t,(v+(1-p[i])*T2_)/p[i]);
				for(int $=1;$<=k&&j+$<=h;++$) f[i][j][k]=min(f[i][j][k],f[i][j+$][k-$]+T1*$);
			}
			for(int j=2;j<=h;++j){
				t=inf;
				for(int k=0;k<=s;++k) t=min(t,f[i][j][k]);
				for(int k=0;k<=s;++k) f[i][j][k]=t;
			}
		}
	}
	printf("%Lf",f[1][h][s]);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1 2 0
50
0
1 2

output:

4.000000

result:

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

Test #2:

score: 0
Accepted
time: 2ms
memory: 3548kb

input:

2 3 1
50 50
1 1
1 3

output:

6.000000

result:

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

Test #3:

score: 0
Accepted
time: 2ms
memory: 3660kb

input:

1 6 4
75
0
64 6

output:

1.341146

result:

ok found '1.3411460', expected '1.3411458', error '0.0000001'

Test #4:

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

input:

1 5 1
61
1 1
15 43

output:

2.208223

result:

ok found '2.2082230', expected '2.2082232', error '0.0000001'

Test #5:

score: 0
Accepted
time: 2ms
memory: 3684kb

input:

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

output:

942.414842

result:

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

Test #6:

score: 0
Accepted
time: 2ms
memory: 3712kb

input:

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

output:

401.866863

result:

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

Test #7:

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

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:

13395.855063

result:

ok found '13395.8550630', expected '13395.8550625', error '0.0000000'

Test #8:

score: 0
Accepted
time: 2ms
memory: 3632kb

input:

100 6 5
71 18 59 37 83 16 53 4 42 38 52 89 95 42 39 17 27 84 53 45 36 50 7 63 23 69 34 74 68 13 65 81 48 77 36 87 57 22 47 70 50 54 16 63 32 96 70 30 25 97 35 33 59 76 40 54 68 60 19 34 73 8 71 77 97 39 27 37 93 19 71 94 61 33 28 80 86 79 16 2 42 89 19 43 97 52 95 69 53 67 37 51 4 53 7 36 82 67 80 2...

output:

15012.983303

result:

ok found '15012.9833030', expected '15012.9833032', error '0.0000000'

Test #9:

score: -100
Wrong Answer
time: 2ms
memory: 3780kb

input:

100 4 1
15 95 82 67 93 57 92 60 48 53 26 94 10 24 88 48 48 28 9 62 55 6 8 39 25 87 14 10 50 19 24 89 11 98 3 30 16 22 43 80 26 49 47 59 38 70 79 94 2 72 78 28 83 34 30 52 45 83 9 42 63 46 83 95 49 21 38 48 87 65 45 7 91 9 5 32 57 21 39 34 71 69 87 44 12 38 72 99 55 23 21 42 87 91 85 93 47 28 25 96
8...

output:

22460.556998

result:

wrong answer 1st numbers differ - expected: '22457.8011510', found: '22460.5569980', error = '0.0001227'