# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
827309 |
2023-08-16T10:49:57 Z |
rainboy |
Peru (RMI20_peru) |
C |
|
0 ms |
0 KB |
#include "peru.h"
#include <string.h>
#define N 2500000
#define MD 1000000007
#define X 23
long long min(long long a, long long b) { return a < b ? a : b; }
int max(int a, int b) { return a > b ? a : b; }
int solve(int n, int k, int *aa) {
static long long dp[N + 1];
int i, j, a, ans;
memset(dp, 0x3f, (n + 1) * sizeof *dp), dp[0] = 0;
for (i = 0; i < n; i++) {
a = 0;
for (j = i; j < n && j - i < k; j++) {
a = max(a, aa[j]);
dp[j + 1] = min(dp[j + 1], dp[i] + a);
}
}
ans = 0;
for (i = 0; i <= n; i++)
ans = ((long long) ans * X + dp[i] % MD) % MD;
return ans;
}
Compilation message
grader.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.