답안 #533936

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

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

int solve(int n, int k, int* a){
	for(int i=0;i<n;i++){
		dp[i] = 1e18;
		int mx = a[i];
		for(int j=i-1;j>=max(0, i-k);j--){
			dp[i] = min(dp[i], dp[j] + mx);
			mx = max(mx, a[j]);
		}
		
		if(i < k) dp[i] = min(dp[i], 1ll * mx);
	}
	
	int res = 0;
	for(int i=0;i<n;i++){
		res = (res * 23ll + dp[i]) % mod;
	} 
	
	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 Execution timed out 631 ms 6988 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 631 ms 6988 KB Time limit exceeded
2 Halted 0 ms 0 KB -