답안 #533932

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
533932 2022-03-07T16:12:50 Z amunduzbaev Peru (RMI20_peru) C++17
18 / 100
581 ms 3540 KB
#include "bits/stdc++.h"
using namespace std;
#include "peru.h"
#ifndef EVAL
#include "grader.cpp"
#endif

#define i32 int32_t
#define ar array
#define int long long
const int N = 2e3 + 5;
const int mod = 1e9 + 7;
int a[N], dp[N];

i32 solve(i32 n, i32 k, i32* a){
	memset(dp, 127, sizeof dp);
	for(int i=0;i<n;i++){
		int mx = a[i];
		for(int j=i-1;j>=max(0ll, i-k);j--){
			dp[i] = min(dp[i], dp[j] + mx);
			mx = max(mx, 1ll * a[j]);
		}
		
		if(i < k) dp[i] = min(dp[i], mx);
	}
	
	int res = 0;
	for(int i=0;i<n;i++){
		res = (res * 23ll + dp[i]) % mod;
		//~ cout<<dp[i]<<" ";
	} 
	//~ cout<<"\n";
	
	return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Incorrect 581 ms 3540 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 581 ms 3540 KB Output isn't correct
2 Halted 0 ms 0 KB -