이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,dp[109][109],f[109],zx;
int main(){
ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin>>a>>b;
for(c=1; c<=a; c++) cin>>f[c];
for(c=0; c<=a; c++){
for(d=0; d<=b; d++) dp[c][d]=999999999;
}
dp[0][0]=0;
for(c=1; c<=a; c++){
for(d=1; d<=b; d++){
if(d>c) break;
zx=f[c];
for(e=c-1; e>=d-1; e--){
if(zx<f[e]) zx=f[e];
if(dp[c][d]>dp[e][d-1]+zx) dp[c][d]=dp[e][d-1]+zx;
}
}
}
cout<<dp[a][b];
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |