답안 #39281

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
39281 2018-01-10T15:29:35 Z MrPlany K개의 묶음 (IZhO14_blocks) C++14
53 / 100
0 ms 2060 KB
#include <bits/stdc++.h>

using namespace std;

int n, a[109], dp[109][109], k;

int main(){
	
	scanf("%d%d",&n,&k);
//	if(n>100) return 0;
	
	for(int i=1;i<=n;i++) scanf("%d",a+i);
	
	for(int i=1;i<=n;i++) dp[1][i] = max(dp[1][i-1], a[i]);
	
	for(int i=2;i<=n;i++){
		
		for(int j=i;j<=n;j++){
			
			long long mx = 0, mn=1e9;
			
			for(int f = j; f>=i; f--){
				mx = max(mx, (long long)a[f]);
				
				mn= min( mx + dp[i-1][f-1], mn );
				
			}
			dp[i][j] = mn;
			
		}
		
	}
	
	cout << dp[k][n];
	return 0;
}

Compilation message

blocks.cpp: In function 'int main()':
blocks.cpp:9:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&n,&k);
                     ^
blocks.cpp:12:39: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;i<=n;i++) scanf("%d",a+i);
                                       ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2060 KB Output is correct
2 Correct 0 ms 2060 KB Output is correct
3 Correct 0 ms 2060 KB Output is correct
4 Correct 0 ms 2060 KB Output is correct
5 Correct 0 ms 2060 KB Output is correct
6 Correct 0 ms 2060 KB Output is correct
7 Correct 0 ms 2060 KB Output is correct
8 Correct 0 ms 2060 KB Output is correct
9 Correct 0 ms 2060 KB Output is correct
10 Correct 0 ms 2060 KB Output is correct
11 Correct 0 ms 2060 KB Output is correct
12 Correct 0 ms 2060 KB Output is correct
13 Correct 0 ms 2060 KB Output is correct
14 Correct 0 ms 2060 KB Output is correct
15 Correct 0 ms 2060 KB Output is correct
16 Correct 0 ms 2060 KB Output is correct
17 Correct 0 ms 2060 KB Output is correct
18 Correct 0 ms 2060 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2060 KB Output is correct
2 Correct 0 ms 2060 KB Output is correct
3 Correct 0 ms 2060 KB Output is correct
4 Correct 0 ms 2060 KB Output is correct
5 Correct 0 ms 2060 KB Output is correct
6 Correct 0 ms 2060 KB Output is correct
7 Correct 0 ms 2060 KB Output is correct
8 Correct 0 ms 2060 KB Output is correct
9 Correct 0 ms 2060 KB Output is correct
10 Correct 0 ms 2060 KB Output is correct
11 Correct 0 ms 2060 KB Output is correct
12 Correct 0 ms 2060 KB Output is correct
13 Correct 0 ms 2060 KB Output is correct
14 Correct 0 ms 2060 KB Output is correct
15 Correct 0 ms 2060 KB Output is correct
16 Correct 0 ms 2060 KB Output is correct
17 Correct 0 ms 2060 KB Output is correct
18 Correct 0 ms 2060 KB Output is correct
19 Correct 0 ms 2060 KB Output is correct
20 Correct 0 ms 2060 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2060 KB Output is correct
2 Correct 0 ms 2060 KB Output is correct
3 Correct 0 ms 2060 KB Output is correct
4 Correct 0 ms 2060 KB Output is correct
5 Correct 0 ms 2060 KB Output is correct
6 Correct 0 ms 2060 KB Output is correct
7 Correct 0 ms 2060 KB Output is correct
8 Correct 0 ms 2060 KB Output is correct
9 Correct 0 ms 2060 KB Output is correct
10 Correct 0 ms 2060 KB Output is correct
11 Correct 0 ms 2060 KB Output is correct
12 Correct 0 ms 2060 KB Output is correct
13 Correct 0 ms 2060 KB Output is correct
14 Correct 0 ms 2060 KB Output is correct
15 Correct 0 ms 2060 KB Output is correct
16 Correct 0 ms 2060 KB Output is correct
17 Correct 0 ms 2060 KB Output is correct
18 Correct 0 ms 2060 KB Output is correct
19 Correct 0 ms 2060 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 2060 KB Execution killed because of forbidden syscall futex (202)
2 Halted 0 ms 0 KB -