# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
493490 |
2021-12-11T16:15:09 Z |
Jeff12345121 |
Peru (RMI20_peru) |
C++17 |
|
600 ms |
3540 KB |
#include <bits/stdc++.h>
#define int long long
#define ll int
#include "peru.h"
using namespace std;
const ll nmax = 2005;
const ll P = 1000000007;
ll dp[nmax];
int32_t solve(int32_t N, int32_t K, int32_t* S) {
for (ll i = 1; i <= N; i++) dp[i] = LLONG_MAX;
for (ll i = 1; i <= N; i++) {
ll maxSoFar = -1;
for (ll j = i - 1; j >= 0 && j >= i - K; j--) {
maxSoFar = max(maxSoFar, 1LL * S[j]);
dp[i] = min(dp[i], (dp[j] + maxSoFar));
}
}
int dhs=1, ans=0;
for(int i=N; i>=1; i--)
{
ans+=(dp[i]%P*dhs)%P;
ans%=P;
dhs=(dhs*23)%P;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Execution timed out |
1086 ms |
3540 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1086 ms |
3540 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |