# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
314457 | shrek12357 | Sličice (COCI19_slicice) | C++14 | 159 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <climits>
#include <cmath>
#include <fstream>
#include <queue>
#include <stack>
#include <bitset>
using namespace std;
#define ll long long
//cin.tie(0);ios_base::sync_with_stdio(0);
const int MAXN = 505;
vector<int> dp(MAXN);
int main() {
int n, m, k;
cin >> n >> m >> k;
vector<int> curs;
for (int i = 0; i < n; i++) {
int temp;
cin >> temp;
curs.push_back(temp);
}
vector<int> vals;
for (int i = 0; i < m + 1; i++) {
int temp;
cin >> temp;
vals.push_back(temp);
}
for (int i = 0; i < n; i++) {
vector<int> temp(MAXN);
for (int j = 0; j <= k; j++) {
for(int a = 0; a <= m; a++){
if (a > j) {
break;
}
if (curs[i] + a > m) {
break;
}
int val = vals[curs[i] + a];
temp[j] = max(dp[j - a] + val, temp[j]);
}
}
dp = temp;
}
cout << dp[k] << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |