Submission #1064568

# Submission time Handle Problem Language Result Execution time Memory
1064568 2024-08-18T14:40:14 Z beaconmc Tricks of the Trade (CEOI23_trade) C++14
20 / 100
699 ms 408656 KB
#include <bits/stdc++.h>
 
typedef long long ll;
#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(ll i=x; i>y; i--)
 
using namespace std;


ll dp[250005][205];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	FOR(i,0,250005)FOR(j,0,205) dp[i][j] = -100000000000000000;

	ll n,k;
	cin >> n >> k;
	vector<ll> price(n), sell(n);
	FOR(i,0,n) cin >> price[i];
	FOR(i,0,n) cin >> sell[i];
	FOR(i,0,250005) dp[i][0] = 0;

	FOR(j,0,205){
		FOR(i,0,n){
			dp[i+1][j] = max(dp[i+1][j], dp[i][j] - price[i]);
			dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] - price[i] + sell[i]);
		}
	}
	ll ans = -100000000000000000;


	FOR(i,k,n+1){

		ans = max(ans, dp[i][k]);
	}
	cout << ans << endl;







}
# Verdict Execution time Memory Grader output
1 Partially correct 130 ms 401488 KB Partially correct
2 Partially correct 131 ms 401500 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 130 ms 401492 KB Partially correct
2 Partially correct 136 ms 401380 KB Partially correct
3 Partially correct 130 ms 401380 KB Partially correct
4 Partially correct 137 ms 401492 KB Partially correct
5 Partially correct 132 ms 401488 KB Partially correct
6 Partially correct 134 ms 401388 KB Partially correct
7 Partially correct 137 ms 401488 KB Partially correct
8 Partially correct 132 ms 401488 KB Partially correct
9 Partially correct 129 ms 401492 KB Partially correct
10 Partially correct 133 ms 401492 KB Partially correct
11 Partially correct 149 ms 401436 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 130 ms 401492 KB Partially correct
2 Partially correct 136 ms 401380 KB Partially correct
3 Partially correct 130 ms 401380 KB Partially correct
4 Partially correct 137 ms 401492 KB Partially correct
5 Partially correct 132 ms 401488 KB Partially correct
6 Partially correct 134 ms 401388 KB Partially correct
7 Partially correct 137 ms 401488 KB Partially correct
8 Partially correct 132 ms 401488 KB Partially correct
9 Partially correct 129 ms 401492 KB Partially correct
10 Partially correct 133 ms 401492 KB Partially correct
11 Partially correct 149 ms 401436 KB Partially correct
12 Partially correct 135 ms 401448 KB Partially correct
13 Partially correct 135 ms 401492 KB Partially correct
14 Partially correct 135 ms 401492 KB Partially correct
15 Partially correct 152 ms 401580 KB Partially correct
16 Partially correct 138 ms 401536 KB Partially correct
17 Partially correct 137 ms 401596 KB Partially correct
18 Partially correct 130 ms 401528 KB Partially correct
19 Partially correct 140 ms 401488 KB Partially correct
20 Partially correct 135 ms 401492 KB Partially correct
21 Partially correct 153 ms 401524 KB Partially correct
22 Partially correct 136 ms 401488 KB Partially correct
23 Incorrect 153 ms 401664 KB Output isn't correct
24 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 140 ms 401472 KB Partially correct
2 Partially correct 581 ms 406100 KB Partially correct
3 Partially correct 562 ms 408620 KB Partially correct
4 Partially correct 578 ms 408640 KB Partially correct
5 Partially correct 556 ms 408400 KB Partially correct
6 Partially correct 537 ms 408144 KB Partially correct
7 Partially correct 575 ms 407636 KB Partially correct
8 Partially correct 582 ms 408400 KB Partially correct
9 Partially correct 564 ms 406976 KB Partially correct
10 Partially correct 555 ms 407636 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 140 ms 401472 KB Partially correct
2 Partially correct 581 ms 406100 KB Partially correct
3 Partially correct 562 ms 408620 KB Partially correct
4 Partially correct 578 ms 408640 KB Partially correct
5 Partially correct 556 ms 408400 KB Partially correct
6 Partially correct 537 ms 408144 KB Partially correct
7 Partially correct 575 ms 407636 KB Partially correct
8 Partially correct 582 ms 408400 KB Partially correct
9 Partially correct 564 ms 406976 KB Partially correct
10 Partially correct 555 ms 407636 KB Partially correct
11 Partially correct 138 ms 401492 KB Partially correct
12 Partially correct 568 ms 406436 KB Partially correct
13 Partially correct 699 ms 408656 KB Partially correct
14 Partially correct 608 ms 408584 KB Partially correct
15 Partially correct 577 ms 408404 KB Partially correct
16 Partially correct 642 ms 408176 KB Partially correct
17 Partially correct 589 ms 407540 KB Partially correct
18 Partially correct 562 ms 408400 KB Partially correct
19 Partially correct 596 ms 406848 KB Partially correct
20 Partially correct 573 ms 407636 KB Partially correct
21 Partially correct 136 ms 401492 KB Partially correct
22 Partially correct 136 ms 401488 KB Partially correct
23 Partially correct 146 ms 401492 KB Partially correct
24 Partially correct 135 ms 401492 KB Partially correct
25 Partially correct 148 ms 401488 KB Partially correct
26 Partially correct 153 ms 401560 KB Partially correct
27 Partially correct 140 ms 401492 KB Partially correct
28 Partially correct 135 ms 401572 KB Partially correct
29 Partially correct 136 ms 401492 KB Partially correct
30 Partially correct 141 ms 401400 KB Partially correct
31 Partially correct 595 ms 408540 KB Partially correct
32 Partially correct 633 ms 408536 KB Partially correct
33 Partially correct 595 ms 408156 KB Partially correct
34 Partially correct 620 ms 407892 KB Partially correct
35 Partially correct 604 ms 407612 KB Partially correct
36 Partially correct 559 ms 406872 KB Partially correct
37 Partially correct 603 ms 406756 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 130 ms 401488 KB Partially correct
2 Partially correct 131 ms 401500 KB Partially correct
3 Partially correct 130 ms 401492 KB Partially correct
4 Partially correct 136 ms 401380 KB Partially correct
5 Partially correct 130 ms 401380 KB Partially correct
6 Partially correct 137 ms 401492 KB Partially correct
7 Partially correct 132 ms 401488 KB Partially correct
8 Partially correct 134 ms 401388 KB Partially correct
9 Partially correct 137 ms 401488 KB Partially correct
10 Partially correct 132 ms 401488 KB Partially correct
11 Partially correct 129 ms 401492 KB Partially correct
12 Partially correct 133 ms 401492 KB Partially correct
13 Partially correct 149 ms 401436 KB Partially correct
14 Partially correct 135 ms 401448 KB Partially correct
15 Partially correct 135 ms 401492 KB Partially correct
16 Partially correct 135 ms 401492 KB Partially correct
17 Partially correct 152 ms 401580 KB Partially correct
18 Partially correct 138 ms 401536 KB Partially correct
19 Partially correct 137 ms 401596 KB Partially correct
20 Partially correct 130 ms 401528 KB Partially correct
21 Partially correct 140 ms 401488 KB Partially correct
22 Partially correct 135 ms 401492 KB Partially correct
23 Partially correct 153 ms 401524 KB Partially correct
24 Partially correct 136 ms 401488 KB Partially correct
25 Incorrect 153 ms 401664 KB Output isn't correct
26 Halted 0 ms 0 KB -