| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|
| 1294921 | | WH8 | Peru (RMI20_peru) | C++20 | | 1097 ms | 49276 KiB |
#include "peru.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
int solve(int n, int k, int* v){
vector<ll> dp(n, 1e15), cand(n, 0);
for(int i=0;i<n;i++){
for(int j=i-1;j>=i-k;j--){
int mx=0;
for(int k=j+1;k<=i;k++){
mx=max(mx, (k < 0? 0:v[k]));
}
dp[i]=min(dp[i], (j< 0? 0:dp[j])+mx);
}
}
ll ans=0, mul=1;
for(int i=n-1;i>=0;i--){
ans=(ans+mul*(dp[i]%mod)%mod)%mod;
mul=mul*23%mod;
}
return ans;
}
/*
5 2
2000000000 2000000000 2000000000 2000000000 2000000000
*/
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |