# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
147409 | 2019-08-29T13:08:45 Z | ipaljak | Sličice (COCI19_slicice) | C++14 | 62 ms | 1404 KB |
#include <bits/stdc++.h> using namespace std; #define TRACE(x) cerr << #x << " " << x << endl #define FOR(i, a, b) for (int i = (a); i < int(b); ++i) #define REP(i, n) FOR(i, 0, n) #define _ << " " << typedef long long llint; const int MOD = 1e9 + 7; const int MAXN = 505; int n, m, k; int p[MAXN], b[MAXN], dp[MAXN][MAXN]; int main(void) { scanf("%d%d%d", &n, &m, &k); for (int i = 0; i < n; ++i) scanf("%d", &p[i + 1]); for (int i = 0; i < m + 1; ++i) scanf("%d", &b[i]); for (int i = 1; i <= n; ++i) for (int j = 0; j <= k; ++j) for (int l = p[i]; l <= m && (l - p[i]) <= j; ++l) dp[i][j] = max(dp[i][j], dp[i - 1][j - (l - p[i])] + b[l]); printf("%d\n", dp[n][k]); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1404 KB | Output is correct |
2 | Correct | 3 ms | 1276 KB | Output is correct |
3 | Correct | 59 ms | 1272 KB | Output is correct |
4 | Correct | 61 ms | 1264 KB | Output is correct |
5 | Correct | 60 ms | 1272 KB | Output is correct |
6 | Correct | 60 ms | 1272 KB | Output is correct |
7 | Correct | 58 ms | 1272 KB | Output is correct |
8 | Correct | 62 ms | 1304 KB | Output is correct |
9 | Correct | 59 ms | 1272 KB | Output is correct |
10 | Correct | 62 ms | 1380 KB | Output is correct |