QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#293864#3994. Easy JumprageOfThunderWA 1ms3752kbC++142.5kb2023-12-29 21:12:182023-12-29 21:12:18

Judging History

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

  • [2023-12-29 21:12:18]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3752kb
  • [2023-12-29 21:12:18]
  • 提交

answer

// MagicDark
#include <bits/stdc++.h>
#define debug cerr << "[" << __LINE__ << "] "
#define SZ(x) (int) x.size() - 1
#define all(x) x.begin(), x.end()
#define ms(x, y) memset(x, y, sizeof x)
#define F(i, x, y) for (int i = (x); i <= (y); i++)
#define DF(i, x, y) for (int i = (x); i >= (y); i--)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template <typename T> inline void chkmax(T& x, T y) {x = max(x, y);}
template <typename T> inline void chkmin(T& x, T y) {x = min(x, y);}
template <typename T> inline void read(T &x) {
	x = 0; int f = 1; char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
	x *= f;
}
int n, h, s;
double p[1010], f[1010][15][15], g[15];
int t1, t2;
bool t[1010];
double merge(double x, double y) {
	return (x < 0) ? y : (y < 0 ? x : min(x, y));
}
signed main() {
	cin.tie(0) -> sync_with_stdio(0); // don't use puts
	cin >> n >> h >> s;
	F(i, 1, n) {
		cin >> p[i];
		p[i] /= 100;
	}
	{
		int t; cin >> t;
		while (t--) {
			int x; cin >> x;
			::t[x] = true;
		}
	}
	cin >> t1 >> t2;
	DF(i, n, 1) {
		if (t[i]) {
			F(a, 1, h) g[a] = -1;
			F(_, 1, 1000) {
			F(a, 1, h) {
				if (a > 1) {// 操作 1
					double A = f[i + 1][a][s];
					if (A >= 0) {
						A = (A + (1 - p[i]) * t2 + 1) / p[i];
						double B = -1;
						if (g[a - 1] >= 0) B = 1 + p[i] * f[i + 1][a][s] + (1 - p[i]) * g[a - 1];
						g[a] = merge(g[a], merge(A, B));
					}
				}
			}
			DF(a, h - 1, 1) g[a] = merge(g[a], g[a + 1] + t1);
			}
			F(j, 1, h + s)
				DF(a, h, 1) {
					int b = j - a;
					if (b < 0 || b > s) continue;
					f[i][a][b] = g[a];
				}
			// F(a, 1, h) cout << g[a] << " "; cout << endl;
		} else {
			F(j, 1, h + s)
				DF(a, h, 1) {
					int b = j - a;
					if (b < 0 || b > s) continue;
					f[i][a][b] = -1;
					if (a > 1) {// 操作 1
						double A = f[i + 1][a][b];
						if (A >= 0) {
							A = (A + (1 - p[i]) * t2 + 1) / p[i];
							double B = -1;
							if (f[i][a - 1][b] >= 0) B = 1 + p[i] * f[i + 1][a][b] + (1 - p[i]) * f[i][a - 1][b];
							f[i][a][b] = merge(f[i][a][b], merge(A, B));
						}
					}
					// 操作 2
					if (a < h && b) f[i][a][b] = merge(f[i][a][b], f[i][a + 1][b - 1] + t1);//, debug << f[i][a + 1][b - 1] << endl;
				}
		}
		// F(a, 1, h)
		// 	F(b, 0, s)
		// 		cout << f[i][a][b] << " \n"[b == s];
		// cout << endl;
	}
	cout << fixed << setprecision(10) << f[1][h][s];
	return 0;
}
/* why?
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1 2 0
50
0
1 2

output:

4.0000000000

result:

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

Test #2:

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

input:

2 3 1
50 50
1 1
1 3

output:

6.0000000000

result:

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

Test #3:

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

input:

1 6 4
75
0
64 6

output:

1.3411458333

result:

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

Test #4:

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

input:

1 5 1
61
1 1
15 43

output:

2.2082231967

result:

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

Test #5:

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

input:

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

output:

25575.8705839807

result:

wrong answer 1st numbers differ - expected: '942.4148420', found: '25575.8705840', error = '26.1386543'