답안 #5149

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
5149 2014-02-10T17:42:40 Z tncks0121 K개의 묶음 (IZhO14_blocks) C++
53 / 100
1000 ms 83512 KB
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h> 
#include <stdlib.h> 
#include <string.h> 
#include <memory.h> 
#include <math.h> 
#include <assert.h> 
#include <stack> 
#include <queue> 
#include <map> 
#include <set> 
#include <algorithm> 
#include <string> 
#include <functional> 
#include <vector> 
#include <deque> 
#include <utility> 
#include <bitset> 
#include <limits.h>  
#include <time.h>

using namespace std; 
typedef long long ll; 
typedef unsigned long long llu; 
typedef double lf;
typedef unsigned int uint;
typedef long double llf;
typedef pair<int, int> pii;

const int N_ = 100005, K_ = 105;

int N, K;
int A[N_];
ll Table[N_][K_];

int main() {
	scanf("%d%d", &N, &K);
	for(int i = 1; i <= N; i++) scanf("%d", A+i);
	
	for(int k = 0; k <= K; k++) Table[1][k] = (ll)1e15;
	Table[1][1] = A[1];

	for(int i = 2; i <= N; i++) {
		for(int k = 0; k <= K; k++) Table[i][k] = (ll)1e15;
		for(int k = 1; k <= i && k <= K; k++) {
			ll mx = 0;
			for(int j = i; j > 0; j--) {
				mx = max(mx, (ll)A[j]);
				if(k <= j) Table[i][k] = min(Table[i][k], Table[j - 1][k - 1] + mx);
			}
		}
	}

	printf("%lld\n", Table[N][K]);
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 83512 KB Output is correct
2 Correct 0 ms 83512 KB Output is correct
3 Correct 0 ms 83512 KB Output is correct
4 Correct 0 ms 83512 KB Output is correct
5 Correct 0 ms 83512 KB Output is correct
6 Correct 0 ms 83512 KB Output is correct
7 Correct 0 ms 83512 KB Output is correct
8 Correct 0 ms 83512 KB Output is correct
9 Correct 0 ms 83512 KB Output is correct
10 Correct 0 ms 83512 KB Output is correct
11 Correct 0 ms 83512 KB Output is correct
12 Correct 0 ms 83512 KB Output is correct
13 Correct 0 ms 83512 KB Output is correct
14 Correct 0 ms 83512 KB Output is correct
15 Correct 0 ms 83512 KB Output is correct
16 Correct 0 ms 83512 KB Output is correct
17 Correct 0 ms 83512 KB Output is correct
18 Correct 0 ms 83512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 83512 KB Output is correct
2 Correct 0 ms 83512 KB Output is correct
3 Correct 0 ms 83512 KB Output is correct
4 Correct 0 ms 83512 KB Output is correct
5 Correct 0 ms 83512 KB Output is correct
6 Correct 0 ms 83512 KB Output is correct
7 Correct 0 ms 83512 KB Output is correct
8 Correct 0 ms 83512 KB Output is correct
9 Correct 0 ms 83512 KB Output is correct
10 Correct 0 ms 83512 KB Output is correct
11 Correct 0 ms 83512 KB Output is correct
12 Correct 0 ms 83512 KB Output is correct
13 Correct 0 ms 83512 KB Output is correct
14 Correct 0 ms 83512 KB Output is correct
15 Correct 0 ms 83512 KB Output is correct
16 Correct 0 ms 83512 KB Output is correct
17 Correct 0 ms 83512 KB Output is correct
18 Correct 0 ms 83512 KB Output is correct
19 Correct 0 ms 83512 KB Output is correct
20 Correct 0 ms 83512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 83512 KB Output is correct
2 Correct 0 ms 83512 KB Output is correct
3 Correct 0 ms 83512 KB Output is correct
4 Correct 0 ms 83512 KB Output is correct
5 Correct 0 ms 83512 KB Output is correct
6 Correct 0 ms 83512 KB Output is correct
7 Correct 0 ms 83512 KB Output is correct
8 Correct 0 ms 83512 KB Output is correct
9 Correct 0 ms 83512 KB Output is correct
10 Correct 0 ms 83512 KB Output is correct
11 Correct 0 ms 83512 KB Output is correct
12 Correct 0 ms 83512 KB Output is correct
13 Correct 0 ms 83512 KB Output is correct
14 Correct 0 ms 83512 KB Output is correct
15 Correct 0 ms 83512 KB Output is correct
16 Correct 0 ms 83512 KB Output is correct
17 Correct 0 ms 83512 KB Output is correct
18 Correct 0 ms 83512 KB Output is correct
19 Correct 0 ms 83512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1000 ms 83508 KB Program timed out
2 Halted 0 ms 0 KB -