Submission #804749

# Submission time Handle Problem Language Result Execution time Memory
804749 2023-08-03T11:08:35 Z flappybird Fun Palace (CCO18_fun) C++17
25 / 25
66 ms 79356 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define MAX 1010
#define MAXS 20
#define INF 1000000000
#define bb ' '
#define ln '\n'
#define Ln '\n'
#define MOD 1000000007
int A[MAX];
int B[MAX];
int dp[MAX][20010];
signed main() {
	ios::sync_with_stdio(false), cin.tie(0);
	int N, E;
	cin >> N >> E;
	int i, j;
	int U = E - 1;
	for (i = 2; i <= N; i++) {
		cin >> A[i] >> B[i];
		U = max(U, A[i] + B[i]);
	}
	fill(&dp[0][0], &dp[MAX - 1][MAX], -INF);
	for (i = 0; i < E; i++) dp[1][i] = i;
	for (i = 2; i <= N; i++) {
		int mx = 0;
		for (j = 0; j < A[i]; j++) mx = max(mx, dp[i - 1][j]);
		for (j = 0; j < B[i]; j++) dp[i][j] = max(dp[i][j], mx + j);
		for (j = A[i] + B[i]; j <= U; j++) dp[i][j] = max(dp[i][j], dp[i - 1][j]);
		for (j = A[i]; j < A[i] + B[i]; j++) dp[i][j - A[i]] = max(dp[i][j - A[i]], dp[i - 1][j]);
		for (j = 0; j < A[i]; j++) dp[i][B[i] + j] = max(dp[i][B[i] + j], dp[i - 1][j] + B[i]);
	}
	int mx = 0;
	for (i = 0; i <= U; i++) mx = max(mx, dp[N][i]);
	cout << mx;
}
# Verdict Execution time Memory Grader output
1 Correct 32 ms 79316 KB Output is correct
2 Correct 34 ms 79272 KB Output is correct
3 Correct 42 ms 79320 KB Output is correct
4 Correct 42 ms 79252 KB Output is correct
5 Correct 30 ms 79260 KB Output is correct
6 Correct 36 ms 79216 KB Output is correct
7 Correct 29 ms 79228 KB Output is correct
8 Correct 31 ms 79260 KB Output is correct
9 Correct 30 ms 79268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 79292 KB Output is correct
2 Correct 42 ms 79280 KB Output is correct
3 Correct 29 ms 79320 KB Output is correct
4 Correct 41 ms 79272 KB Output is correct
5 Correct 32 ms 79324 KB Output is correct
6 Correct 32 ms 79320 KB Output is correct
7 Correct 32 ms 79260 KB Output is correct
8 Correct 43 ms 79308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 79316 KB Output is correct
2 Correct 34 ms 79272 KB Output is correct
3 Correct 42 ms 79320 KB Output is correct
4 Correct 42 ms 79252 KB Output is correct
5 Correct 30 ms 79260 KB Output is correct
6 Correct 36 ms 79216 KB Output is correct
7 Correct 29 ms 79228 KB Output is correct
8 Correct 31 ms 79260 KB Output is correct
9 Correct 30 ms 79268 KB Output is correct
10 Correct 32 ms 79316 KB Output is correct
11 Correct 32 ms 79316 KB Output is correct
12 Correct 32 ms 79316 KB Output is correct
13 Correct 32 ms 79268 KB Output is correct
14 Correct 31 ms 79304 KB Output is correct
15 Correct 30 ms 79292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 79316 KB Output is correct
2 Correct 34 ms 79272 KB Output is correct
3 Correct 42 ms 79320 KB Output is correct
4 Correct 42 ms 79252 KB Output is correct
5 Correct 30 ms 79260 KB Output is correct
6 Correct 36 ms 79216 KB Output is correct
7 Correct 29 ms 79228 KB Output is correct
8 Correct 31 ms 79260 KB Output is correct
9 Correct 30 ms 79268 KB Output is correct
10 Correct 29 ms 79292 KB Output is correct
11 Correct 42 ms 79280 KB Output is correct
12 Correct 29 ms 79320 KB Output is correct
13 Correct 41 ms 79272 KB Output is correct
14 Correct 32 ms 79324 KB Output is correct
15 Correct 32 ms 79320 KB Output is correct
16 Correct 32 ms 79260 KB Output is correct
17 Correct 43 ms 79308 KB Output is correct
18 Correct 32 ms 79316 KB Output is correct
19 Correct 32 ms 79316 KB Output is correct
20 Correct 32 ms 79316 KB Output is correct
21 Correct 32 ms 79268 KB Output is correct
22 Correct 31 ms 79304 KB Output is correct
23 Correct 30 ms 79292 KB Output is correct
24 Correct 30 ms 79232 KB Output is correct
25 Correct 33 ms 79304 KB Output is correct
26 Correct 35 ms 79240 KB Output is correct
27 Correct 66 ms 79348 KB Output is correct
28 Correct 60 ms 79324 KB Output is correct
29 Correct 64 ms 79356 KB Output is correct
30 Correct 55 ms 79348 KB Output is correct