이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "peru.h"
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("popcnt,avx2")
#define forn(i,n) for(int i=0; i<(n); ++i)
#define pb push_back
#define pi pair<int,int>
#define f first
#define s second
using ll = long long;
const int N=2005;
ll dp[N];
int solve(int n, int k, int* v){
const int mod = 1e9+7;
const ll inf = 1e18;
ll ans=0;
forn(i,n) {
dp[i+1]=inf;
int mx=0;
for(int j=i; j>=max(i-k+1,0); --j) {
mx=max(mx,v[j]);
dp[i+1]=min(dp[i+1],dp[j]+mx);
}
ans=(ans*23)%mod;
ans=(ans+dp[i+1])%mod;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |