Submission #162256

# Submission time Handle Problem Language Result Execution time Memory
162256 2019-11-07T10:42:20 Z mosiashvililuka K blocks (IZhO14_blocks) C++14
0 / 100
4 ms 760 KB
#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
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -