# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
474502 | Alexandruabcde | Peru (RMI20_peru) | C++14 | 806 ms | 5212 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "peru.h"
#include <iostream>
using namespace std;
constexpr int NMAX = 2500005;
constexpr int MOD = 1e9 + 7;
typedef long long LL;
LL dp[NMAX];
int ans = 0;
int solve(int n, int k, int* v){
for (int i = 0; i < n; ++ i ) {
int Max_Effort = v[i];
dp[i] = 100000000000000000;
for (int j = i; j > max(0, i-k+1); -- j ) {
Max_Effort = max(Max_Effort, v[j]);
dp[i] = min(dp[i], dp[j-1] + 1LL * Max_Effort);
}
Max_Effort = max(Max_Effort, v[max(0, i-k+1)]);
if (i < k) dp[i] = min(dp[i], 1LL * Max_Effort);
else dp[i] = min(dp[i], dp[i-k] + 1LL * Max_Effort);
}
for (int i = 0; i < n; ++ i ) {
ans = (23LL * ans + dp[i]%MOD) % MOD;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |