Submission #533941

# Submission time Handle Problem Language Result Execution time Memory
533941 2022-03-07T16:29:45 Z amunduzbaev Peru (RMI20_peru) C++17
0 / 100
1 ms 340 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){
	int res = 0;
	for(int i=0;i<n;i++){
		//~ dp[i] = 
		//~ dp[i] = 1e18;
		int mx = a[i];
		for(int j=i-1;j>max(-1, i-k);j--){
			//~ dp[i] = min(dp[i], dp[j] + mx);
			mx = max(mx, a[j]);
		}
		
		if(i < k) dp[i] = mx;
		else dp[i] = dp[i-k] + mx;
		res = (res * 23ll + dp[i]) % mod;
	}
	return res;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -