# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
533931 |
2022-03-07T16:11:54 Z |
amunduzbaev |
Peru (RMI20_peru) |
C++17 |
|
600 ms |
21560 KB |
#include "bits/stdc++.h"
using namespace std;
#include "peru.h"
#ifndef EVAL
#include "grader.cpp"
#endif
#define i32 int32_t
#define ar array
#define int long long
const int N = 25e5 + 5;
const int mod = 1e9 + 7;
int a[N], dp[N];
i32 solve(i32 n, i32 k, i32* a){
memset(dp, 127, sizeof dp);
for(int i=0;i<n;i++){
int mx = a[i];
for(int j=i-1;j>=max(0ll, i-k);j--){
dp[i] = min(dp[i], dp[j] + mx);
mx = max(mx, 1ll * a[j]);
}
if(i < k) dp[i] = min(dp[i], mx);
}
int res = 0;
for(int i=0;i<n;i++){
res = (res * 23ll + dp[i]) % mod;
//~ cout<<dp[i]<<" ";
}
//~ cout<<"\n";
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
19796 KB |
Output is correct |
2 |
Correct |
8 ms |
19868 KB |
Output is correct |
3 |
Correct |
7 ms |
19796 KB |
Output is correct |
4 |
Correct |
7 ms |
19840 KB |
Output is correct |
5 |
Correct |
8 ms |
19796 KB |
Output is correct |
6 |
Correct |
8 ms |
19796 KB |
Output is correct |
7 |
Correct |
10 ms |
19920 KB |
Output is correct |
8 |
Correct |
7 ms |
19836 KB |
Output is correct |
9 |
Correct |
8 ms |
19804 KB |
Output is correct |
10 |
Correct |
12 ms |
19796 KB |
Output is correct |
11 |
Correct |
9 ms |
19796 KB |
Output is correct |
12 |
Correct |
9 ms |
19844 KB |
Output is correct |
13 |
Correct |
11 ms |
19868 KB |
Output is correct |
14 |
Correct |
9 ms |
19796 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
19796 KB |
Output is correct |
2 |
Correct |
8 ms |
19868 KB |
Output is correct |
3 |
Correct |
7 ms |
19796 KB |
Output is correct |
4 |
Correct |
7 ms |
19840 KB |
Output is correct |
5 |
Correct |
8 ms |
19796 KB |
Output is correct |
6 |
Correct |
8 ms |
19796 KB |
Output is correct |
7 |
Correct |
10 ms |
19920 KB |
Output is correct |
8 |
Correct |
7 ms |
19836 KB |
Output is correct |
9 |
Correct |
8 ms |
19804 KB |
Output is correct |
10 |
Correct |
12 ms |
19796 KB |
Output is correct |
11 |
Correct |
9 ms |
19796 KB |
Output is correct |
12 |
Correct |
9 ms |
19844 KB |
Output is correct |
13 |
Correct |
11 ms |
19868 KB |
Output is correct |
14 |
Correct |
9 ms |
19796 KB |
Output is correct |
15 |
Correct |
591 ms |
21560 KB |
Output is correct |
16 |
Correct |
479 ms |
21460 KB |
Output is correct |
17 |
Correct |
306 ms |
21552 KB |
Output is correct |
18 |
Correct |
342 ms |
21552 KB |
Output is correct |
19 |
Correct |
384 ms |
21492 KB |
Output is correct |
20 |
Execution timed out |
762 ms |
21552 KB |
Time limit exceeded |
21 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
591 ms |
21560 KB |
Output is correct |
2 |
Correct |
479 ms |
21460 KB |
Output is correct |
3 |
Correct |
306 ms |
21552 KB |
Output is correct |
4 |
Correct |
342 ms |
21552 KB |
Output is correct |
5 |
Correct |
384 ms |
21492 KB |
Output is correct |
6 |
Execution timed out |
762 ms |
21552 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |