Submission #1064586

# Submission time Handle Problem Language Result Execution time Memory
1064586 2024-08-18T14:58:25 Z beaconmc Tricks of the Trade (CEOI23_trade) C++14
20 / 100
220 ms 405588 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,n) dp[i][0] = 0;


	FOR(i,0,n){
		FOR(j,0,204){
			dp[i+1][j+1] = max(dp[i][j] + sell[i] - price[i], dp[i][j+1] - price[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 141 ms 401488 KB Partially correct
2 Partially correct 143 ms 401492 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 145 ms 401488 KB Partially correct
2 Partially correct 173 ms 401492 KB Partially correct
3 Partially correct 146 ms 401488 KB Partially correct
4 Partially correct 133 ms 401620 KB Partially correct
5 Partially correct 139 ms 401624 KB Partially correct
6 Partially correct 146 ms 401536 KB Partially correct
7 Partially correct 141 ms 401488 KB Partially correct
8 Partially correct 138 ms 401484 KB Partially correct
9 Partially correct 142 ms 401744 KB Partially correct
10 Partially correct 144 ms 401536 KB Partially correct
11 Partially correct 145 ms 401488 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 145 ms 401488 KB Partially correct
2 Partially correct 173 ms 401492 KB Partially correct
3 Partially correct 146 ms 401488 KB Partially correct
4 Partially correct 133 ms 401620 KB Partially correct
5 Partially correct 139 ms 401624 KB Partially correct
6 Partially correct 146 ms 401536 KB Partially correct
7 Partially correct 141 ms 401488 KB Partially correct
8 Partially correct 138 ms 401484 KB Partially correct
9 Partially correct 142 ms 401744 KB Partially correct
10 Partially correct 144 ms 401536 KB Partially correct
11 Partially correct 145 ms 401488 KB Partially correct
12 Partially correct 139 ms 401492 KB Partially correct
13 Partially correct 134 ms 401488 KB Partially correct
14 Partially correct 131 ms 401512 KB Partially correct
15 Partially correct 135 ms 401492 KB Partially correct
16 Partially correct 136 ms 401492 KB Partially correct
17 Partially correct 135 ms 401484 KB Partially correct
18 Partially correct 134 ms 401384 KB Partially correct
19 Partially correct 135 ms 401464 KB Partially correct
20 Partially correct 135 ms 401372 KB Partially correct
21 Partially correct 139 ms 401796 KB Partially correct
22 Partially correct 130 ms 401484 KB Partially correct
23 Incorrect 141 ms 401488 KB Output isn't correct
24 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 141 ms 401488 KB Partially correct
2 Partially correct 198 ms 405352 KB Partially correct
3 Partially correct 207 ms 405328 KB Partially correct
4 Partially correct 217 ms 405464 KB Partially correct
5 Partially correct 207 ms 405548 KB Partially correct
6 Partially correct 217 ms 405328 KB Partially correct
7 Partially correct 204 ms 405332 KB Partially correct
8 Partially correct 206 ms 405332 KB Partially correct
9 Partially correct 204 ms 405328 KB Partially correct
10 Partially correct 198 ms 405332 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 141 ms 401488 KB Partially correct
2 Partially correct 198 ms 405352 KB Partially correct
3 Partially correct 207 ms 405328 KB Partially correct
4 Partially correct 217 ms 405464 KB Partially correct
5 Partially correct 207 ms 405548 KB Partially correct
6 Partially correct 217 ms 405328 KB Partially correct
7 Partially correct 204 ms 405332 KB Partially correct
8 Partially correct 206 ms 405332 KB Partially correct
9 Partially correct 204 ms 405328 KB Partially correct
10 Partially correct 198 ms 405332 KB Partially correct
11 Partially correct 135 ms 401488 KB Partially correct
12 Partially correct 210 ms 405328 KB Partially correct
13 Partially correct 220 ms 405328 KB Partially correct
14 Partially correct 205 ms 405328 KB Partially correct
15 Partially correct 207 ms 405408 KB Partially correct
16 Partially correct 207 ms 405512 KB Partially correct
17 Partially correct 200 ms 405328 KB Partially correct
18 Partially correct 209 ms 405332 KB Partially correct
19 Partially correct 201 ms 405384 KB Partially correct
20 Partially correct 207 ms 405332 KB Partially correct
21 Partially correct 140 ms 401512 KB Partially correct
22 Partially correct 132 ms 401492 KB Partially correct
23 Partially correct 146 ms 401392 KB Partially correct
24 Partially correct 130 ms 401488 KB Partially correct
25 Partially correct 135 ms 401492 KB Partially correct
26 Partially correct 134 ms 401488 KB Partially correct
27 Partially correct 133 ms 401508 KB Partially correct
28 Partially correct 139 ms 401488 KB Partially correct
29 Partially correct 132 ms 401488 KB Partially correct
30 Partially correct 130 ms 401484 KB Partially correct
31 Partially correct 203 ms 405328 KB Partially correct
32 Partially correct 216 ms 405388 KB Partially correct
33 Partially correct 207 ms 405312 KB Partially correct
34 Partially correct 207 ms 405332 KB Partially correct
35 Partially correct 218 ms 405588 KB Partially correct
36 Partially correct 201 ms 405412 KB Partially correct
37 Partially correct 195 ms 405332 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 141 ms 401488 KB Partially correct
2 Partially correct 143 ms 401492 KB Partially correct
3 Partially correct 145 ms 401488 KB Partially correct
4 Partially correct 173 ms 401492 KB Partially correct
5 Partially correct 146 ms 401488 KB Partially correct
6 Partially correct 133 ms 401620 KB Partially correct
7 Partially correct 139 ms 401624 KB Partially correct
8 Partially correct 146 ms 401536 KB Partially correct
9 Partially correct 141 ms 401488 KB Partially correct
10 Partially correct 138 ms 401484 KB Partially correct
11 Partially correct 142 ms 401744 KB Partially correct
12 Partially correct 144 ms 401536 KB Partially correct
13 Partially correct 145 ms 401488 KB Partially correct
14 Partially correct 139 ms 401492 KB Partially correct
15 Partially correct 134 ms 401488 KB Partially correct
16 Partially correct 131 ms 401512 KB Partially correct
17 Partially correct 135 ms 401492 KB Partially correct
18 Partially correct 136 ms 401492 KB Partially correct
19 Partially correct 135 ms 401484 KB Partially correct
20 Partially correct 134 ms 401384 KB Partially correct
21 Partially correct 135 ms 401464 KB Partially correct
22 Partially correct 135 ms 401372 KB Partially correct
23 Partially correct 139 ms 401796 KB Partially correct
24 Partially correct 130 ms 401484 KB Partially correct
25 Incorrect 141 ms 401488 KB Output isn't correct
26 Halted 0 ms 0 KB -