# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
112150 | dolphingarlic | Sličice (COCI19_slicice) | C++14 | 94 ms | 2424 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define FOR(i, x, y) for (ll i = x; i < y; i++)
#pragma GCC optimize("O3")
typedef long long ll;
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
ll n, m, l;
ll q[501], B[501];
ll dp[501][501]; // dp[i][j] = Max num of points after i teams
// and still have j cards remaining.
cin >> n >> m >> l;
FOR(i, 1, n + 1) {
cin >> q[i];
}
FOR(i, 0, m + 1) {
cin >> B[i];
}
fill(dp[0], dp[0] + 501, 0);
FOR(i, 1, n + 1) {
FOR(j, 0, l + 1) {
dp[i][j] = 0;
FOR(k, 0, l - j + 1) {
// Give k cards to team i
dp[i][j] = max(dp[i][j], dp[i - 1][j + k] + B[min(m, q[i] + k)]);
}
}
}
cout << *max_element(dp[n], dp[n] + l + 1) << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |