제출 #1240362

#제출 시각아이디문제언어결과실행 시간메모리
1240362coderpemulaSličice (COCI19_slicice)C++20
90 / 90
47 ms328 KiB
// +-- -- --++-- +-In the name of ALLAH-+ --++-- -- --+ \\ /* Some Makoto Shinkai's : “Who cares if we can't see any sunshine? I want you more than any blue sky!!!” - Tenki no Ko "By the time the date is over, the comet will be visible in the sky." - Kimi no Nawa “No matter what happens, even if the stars fall, I will live.” - Byōsoku 5 Centimeter */ #include <bits/stdc++.h> #define Raveluk ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ll long long #define ld long double #define pb push_back #define fi first #define se second #define pii pair<int,int> #define tii tuple<int,int,int> #define g1 get<0> #define g2 get<1> #define g3 get<2> #define qf q.front() #define all(x) (x).begin(), (x).end() using namespace std; #define int long long signed main() { Raveluk int n,m,i,j,k,ii; cin>>n>>m>>k; int anu[n+1],skor[m+1],dp[n+1],memo[k+1],trc[k+1],ans=0; memset(dp,0,sizeof(dp)); memset(memo,-1,sizeof(memo)); for(i=1;i<=n;i++) cin>>anu[i]; memo[0] = 0; for(i=0;i<=m;i++) cin>>skor[i]; for(i=1;i<=n;i++){ for(j=0;j<=k;j++) trc[j] = -1; for(j=anu[i];j<=m;j++){ for(ii=0;ii<=k;ii++){ if(ii-(j-anu[i]) < 0) continue; if(memo[ii-(j-anu[i])] == -1) continue; dp[i] = memo[ii-(j-anu[i])]+skor[j]; trc[ii] = max(dp[i],trc[ii]); } } for(j=0;j<=k;j++) memo[j] = max(trc[j],memo[j]); } for(i=0;i<=k;i++) ans = max(ans,memo[i]); cout<<ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...