| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1092640 | alexdd | Peru (RMI20_peru) | C++17 | 3 ms | 344 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "peru.h"
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9+7;
const int INF = 1e18;
int a[2500005];
long long dp[2500005];
int solve(int n, int k, int* v)
{
for(int i=1;i<=n;i++)
{
a[i]=v[i-1];
dp[i]=INF;
int mxm=0;
for(int j=i-1;j>=0;j--)
{
mxm = max(mxm, a[j+1]);
if(j==i-k || a[j+1]==mxm)
{
dp[i] = min(dp[i], dp[j]+mxm);
}
}
}
long long rez=0,put23=1;
for(int i=n;i>0;i--)
{
rez = (rez + put23*dp[i])%MOD;
put23 = put23*23LL%MOD;
}
return rez;
}
/*
8 3
3 2 9 8 7 11 3 4
*/
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
