QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#197343 | #3994. Easy Jump | CharlieVinnie | WA | 0ms | 4080kb | C++17 | 2.0kb | 2023-10-02 14:49:42 | 2023-10-02 14:49:43 |
Judging History
answer
#include "bits/stdc++.h"
#ifdef DEBUG
#include "PrettyDebug.hpp"
#else
#define debug(...)
#endif
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Rev(i,a,b) for(int i=a;i>=b;i--)
#define Fin(file) freopen(file,"r",stdin)
#define Fout(file) freopen(file,"w",stdout)
#define assume(expr) ((!!(expr))||(exit((fprintf(stderr,"Assumption Failed: %s on Line %d\n",#expr,__LINE__),-1)),false))
#define range basic_string_view
using namespace std; typedef long long ll;
signed main(){
atexit([](){cerr<<"Time = "<<clock()<<" ms"<<endl;});
int n,H,S,K,T1,T2; cin>>n>>H>>S; vector<int> blue(n+1); vector<double> p(n+1); For(i,1,n) cin>>p[i],p[i]/=100;
cin>>K; For(i,1,K) { int x; cin>>x; blue[x]=1; }; cin>>T1>>T2;
vector f(H+1,vector(S+1,0.0));
Rev(i,n,1){
if(!blue[i]){
vector g(H+1,vector(S+1,0.0));
// For(k,0,S) g[2][k] = 1 + p[i]*f[2][k] + (1-p[i])*(g[2][k]+T2);
For(k,0,S){
if(k==0||T2<=T1) g[2][k] = ( 1 + p[i]*f[2][k] + (1-p[i])*T2 ) / p[i] ;
else g[2][k] = 1 + p[i]*f[2][k] + (1-p[i])*(g[2][k-1]+T1) ;
}
For(j,3,H) For(k,0,S) g[j][k] = 1 + p[i]*f[j][k] + (1-p[i])*g[j-1][k] ;
f.swap(g);
}
else{
vector res(H+1,double(INFINITY));
For(lim,2,H){
vector g(H+1,0.0);
g[lim] = ( 1 + p[i]*f[lim][S] + (1-p[i])*min(T1,T2) ) / p[i] ;
For(j,1,lim-1) g[j]=g[lim]+(lim-j)*min(T1,T2);
For(j,lim+1,H) g[j] = 1 + p[i]*f[j][S] + (1-p[i])*g[j-1] ;
For(j,1,H) res[j]=min(res[j],g[j]);
}
For(j,0,H) For(k,0,S) f[j][k]=k==S?res[j]:INFINITY;
}
}
cout<<setprecision(12)<<fixed<<f[H][S]<<'\n';
return 0;
}
// START TYPING IF YOU DON'T KNOW WHAT TO DO
// STOP TYPING IF YOU DON'T KNOW WHAT YOU'RE DOING
// CONTINUE, NON-STOPPING, FOR CHARLIEVINNIE
// Started Coding On: October 02 Mon, 12 : 45 : 38
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3760kb
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: 0ms
memory: 3760kb
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: 3892kb
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: 3896kb
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: 0ms
memory: 3892kb
input:
10 9 3 12 65 76 33 17 20 89 16 4 63 3 2 4 8 73 21
output:
942.414842012842
result:
ok found '942.4148420', expected '942.4148420', error '0.0000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 4080kb
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: 0ms
memory: 3964kb
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:
inf
result:
wrong output format Expected double, but "inf" found