# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
224960 |
2020-04-19T07:11:26 Z |
kartel |
Sličice (COCI19_slicice) |
C++14 |
|
82 ms |
4500 KB |
#include <bits/stdc++.h>
#define in(x) freopen(x,"r",stdin)
#define out(x) freopen(x,"w",stdout)
#define F first
#define S second
#define pb push_back
#define M ll(998244353)
#define inf ll(2e9+7)
#define N ll(200500)
#define sz(x) x.size()
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast")
#define el '\n'
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree <ll, null_type, less_equal <ll>, rb_tree_tag, tree_order_statistics_node_update> os;
ll f[501][501], a[501], cost[501], n, m, K, i, j, k;
int main()
{
// in("input.txt");
// out("output.txt");
ios_base::sync_with_stdio(false);
iostream::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> m >> K;
for (i = 1; i <= n; i++) cin >> a[i];
for (i = 0; i <= m; i++) cin >> cost[i];
f[0][0] = 0;
for (i = 0; i < n; i++)
for (j = 0; j <= m; j++)
{
if (a[i + 1] + j > m) break;
for (k = 0; k <= K; k++)
{
f[i + 1][k + j] = max(f[i + 1][k + j], f[i][k] + cost[a[i + 1] + j]);
}
}
cout << f[n][K];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
2304 KB |
Output is correct |
2 |
Incorrect |
6 ms |
2304 KB |
Output isn't correct |
3 |
Incorrect |
76 ms |
2296 KB |
Output isn't correct |
4 |
Incorrect |
77 ms |
2296 KB |
Output isn't correct |
5 |
Incorrect |
76 ms |
2296 KB |
Output isn't correct |
6 |
Incorrect |
75 ms |
2296 KB |
Output isn't correct |
7 |
Incorrect |
73 ms |
2296 KB |
Output isn't correct |
8 |
Incorrect |
80 ms |
2296 KB |
Output isn't correct |
9 |
Incorrect |
72 ms |
2296 KB |
Output isn't correct |
10 |
Runtime error |
82 ms |
4500 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |