-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdiff_Main.cpp
More file actions
46 lines (43 loc) · 933 Bytes
/
Copy pathdiff_Main.cpp
File metadata and controls
46 lines (43 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
diff --git a/CodeJam/Main.cpp b/examples/2020/KS_A/B/Main.cpp
index 2150379..6fd6da5 100644
--- a/CodeJam/Main.cpp
+++ b/examples/2020/KS_A/B/Main.cpp
@@ -1570,11 +1570,41 @@ void init(){
cin >> T;
}
+ll N, K, P;
+v(v(ll)) bnk;
+
void readInput(){
+ cin >> N >> K >> P;
+ ll t;
+ bnk.cl;
+ forn(n, N){
+ bnk.pb(v(ll)());
+ bnk.bk.pb(0);
+ ll s = 0;
+ forn(k, K){
+ cin >> t;
+ s += t;
+ bnk.bk.pb(s);
+ }
+ forn(_, P-K){
+ bnk.bk.pb(s);
+ }
+ }
+ llog("bnk", bnk);
}
// write to COMM_TYPE result
void calcFunction() {
+ v(v(ll)) dp(N+1, v(ll)(P+1, 0));
+ fornn(n, 1, N+1){
+ fornn(p, 1, P+1){
+ forn(s, p+1){
+ dp[n][p] = max(dp[n][p], dp[n-1][s] + bnk[n-1][p-s]);
+ }
+ }
+ }
+ llog("dp", dp);
+ result = dp[N][P];
}
} // namespace task