답안 #285578

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
285578 2020-08-29T09:25:19 Z Ronin13 Discharging (NOI20_discharging) C++14
0 / 100
15 ms 13944 KB
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ull unsigned ll
#define pb push_back
#define mp make_pair
 
using namespace std;
int n;
int m;
ll a[1501];
ll mx[1501][1501];
ll dp[1501];

int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	
	for(int i=1;i<=n;i++){
		ll mxx=-1;
		for(int j=i;j<=n;j++){
			mxx=max(a[j],mxx);
			mx[i][j]=mxx;
		
		}

	}
    for(int i=1;i<=n;i++){
    	dp[i]=1e9;
    	for(int j=1;j<=i;j++){
    		dp[i]=min(dp[i],dp[j-1]+mx[j][i]*(n-j+1));
		}
	}
	cout<<dp[n];
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Incorrect 1 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 15 ms 13944 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 15 ms 13944 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Incorrect 1 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Incorrect 1 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -