답안 #5150

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
5150 2014-02-10T18:14:58 Z tncks0121 K개의 묶음 (IZhO14_blocks) C++
53 / 100
1000 ms 2260 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;

int N, K;
int A[N_];
int Table[2][N_];

int main() {
	scanf("%d%d", &N, &K);
	for(int i = 1; i <= N; i++) scanf("%d", A+i);
	
	for(int i = 1; i <= N; i++) Table[0][i] = (int)1e9;
	for(int k = 1; k <= K; k++) {
		int *now = Table[k&1], *prev = Table[~k&1];
		for(int i = 0; i <= N; i++) now[i] = (int)1e9;
		for(int i = k; i <= N; i++) {
			int mx = 0;
			for(int j = i; j >= k-1; j--) {
				mx = max(mx, A[j]);
				now[i] = min(now[i], prev[j - 1] + mx);
			}
		}
	}

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