# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
100323 | 2019-03-10T11:44:24 Z | AKaan37 | Sličice (COCI19_slicice) | C++14 | 563 ms | 4324 KB |
//Sani buyuk Osman Pasa Plevneden cikmam diyor. //Bismillahirrahmanirrahim #include <bits/stdc++.h> using namespace std; typedef long long int lo; typedef pair< int,int > PII; #define fi first #define se second #define mp make_pair #define pb push_back #define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define FOR for(lo i=1;i<=n;i++) #define mid (bas+son)/2 const lo MAX = -1000000000000000000; const lo MIN = 1000000000000000000; const lo inf = 1000000000; const lo KOK = 100000; const lo LOG = 30; const lo li = 3000005; const lo mod = 1000000007; lo n,m,cev,b[li],a[li],k,dp[705][705]; string s; vector<lo> v; lo f(lo sira,lo hak){ //~ cout<<hak<<" "<<sira<<endl; lo mx=-inf; if(hak<0) return -inf; if(sira>n) return 0; if(~dp[sira][hak]) return dp[sira][hak]; for(int i=0;i<=500;i++){ //~ if(e) mx=max(mx,f(sira+1,hak-i)+b[a[sira]+i]); } return dp[sira][hak]=mx; } int main(){ memset(dp,-1,sizeof(dp)); scanf("%lld %lld %lld",&n,&m,&k); FOR{ scanf("%lld",&a[i]); } for (lo i = 0; i <= m; i++){ scanf("%lld",&b[i]); } for(lo i=m+1;i<=500;i++) b[i]=0; printf("%lld\n",f(1,k)); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 4224 KB | Output is correct |
2 | Correct | 9 ms | 4224 KB | Output is correct |
3 | Correct | 494 ms | 4324 KB | Output is correct |
4 | Correct | 563 ms | 4316 KB | Output is correct |
5 | Correct | 466 ms | 4320 KB | Output is correct |
6 | Correct | 442 ms | 4284 KB | Output is correct |
7 | Correct | 486 ms | 4288 KB | Output is correct |
8 | Correct | 488 ms | 4292 KB | Output is correct |
9 | Correct | 436 ms | 4292 KB | Output is correct |
10 | Correct | 458 ms | 4316 KB | Output is correct |