Submission #115068

#TimeUsernameProblemLanguageResultExecution timeMemory
115068MB81Sličice (COCI19_slicice)C++14
90 / 90
52 ms1528 KiB
// :) // "Khodaya, be man "Tagwaye setiz" biamooz ta // dar anbuh masuliat nalaghzam ..." -Shariati #include <bits/stdc++.h> using namespace std; typedef long long int64; typedef pair<int,int> pii; typedef pair<int64,int> pii32; typedef pair<int64,int64> pii64; #define PB push_back #define MP make_pair #define F first #define S second #define sz(x) ((int)(x).size()) #define all(x) (x).begin(),(x).end() const int maxn = 5e2+10; const int64 MO = 1e9+7; const int64 IN = 1e9; int p[maxn], b[maxn]; int dp[maxn][maxn]; int n, m, k; int main () { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> m >> k; for (int i = 1; i <= n; i++) cin >> p[i]; for (int i = 0; i <= m; i++) cin >> b[i]; for (int i = 0; i < maxn; i++) for (int t = 0; t < maxn; t++) dp[i][t] = -IN; dp[0][0] = 0; for (int i = 1; i <= n; i++) for (int t = 0; t <= k; t++) for (int j = 0; j + t <= k && j + p[i] <= m; j++) dp[i][j + t] = max(dp[i][j + t], dp[i - 1][t] + b[j + p[i]]); cout << dp[n][k] << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...