# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
636981 | iee | Sličice (COCI19_slicice) | C++17 | 45 ms | 1272 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// iee
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a), i##END = (b); i <= (i##END); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)
#define fi first
#define se second
using ll = long long;
using ull = unsigned long long;
using namespace std;
void work(int);
template <class T> void read(T &x) {
x = 0;
int f = 1, ch = getchar();
while (!isdigit(ch)) {
if (ch == '-') f = -1;
ch = getchar();
}
while (isdigit(ch)) {
x = x * 10 + (ch - '0');
ch = getchar();
}
x *= f;
}
int main() {
int TT = 1; // cin >> TT;
rep(CAS, 1, TT)
work(CAS);
return 0;
}
const int N = 505;
int n, m, k, p[N], b[N], f[N][N];
void work(int CASE) {
cin >> n >> m >> k;
rep(i, 1, n) cin >> p[i];
rep(i, 0, m) cin >> b[i];
rep(i, 1, n) rep(j, 0, k) rep(t, 0, min({m - p[i], k, j}))
f[i][j] = max(f[i][j], f[i - 1][j - t] + b[p[i] + t]);
cout << *max_element(f[n], f[n] + N);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |