# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
833139 |
2023-08-22T02:13:42 Z |
isaachew |
Feast (NOI19_feast) |
C++17 |
|
1000 ms |
11000 KB |
#include <bits/stdc++.h>
/*
*/
int main(){
int n,k;
std::cin>>n>>k;
std::vector<int> nums;
for(int i=0;i<n;i++){
int x;
std::cin>>x;
nums.push_back(x);
}
std::vector<long long> seg(n+1);//segment active
std::vector<long long> noseg(n+1);//no segment active
for(int i=0;i<k;i++){
std::vector<long long> seg2(n+1);
std::vector<long long> noseg2(n+1);
for(int j=1;j<n+1;j++){
seg2[j]=std::max(noseg[j],seg2[j-1]+nums[j-1]);
noseg2[j]=std::max(seg2[j],noseg2[j-1]);
}
seg=seg2,noseg=noseg2;
}
std::cout<<noseg[n]<<'\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1050 ms |
10672 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
47 ms |
10640 KB |
Output is correct |
2 |
Correct |
50 ms |
10932 KB |
Output is correct |
3 |
Correct |
50 ms |
10640 KB |
Output is correct |
4 |
Execution timed out |
1090 ms |
10888 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
92 ms |
10852 KB |
Output is correct |
2 |
Correct |
92 ms |
10660 KB |
Output is correct |
3 |
Correct |
91 ms |
10768 KB |
Output is correct |
4 |
Correct |
101 ms |
10708 KB |
Output is correct |
5 |
Correct |
92 ms |
10784 KB |
Output is correct |
6 |
Correct |
100 ms |
11000 KB |
Output is correct |
7 |
Correct |
92 ms |
10944 KB |
Output is correct |
8 |
Correct |
95 ms |
10740 KB |
Output is correct |
9 |
Correct |
93 ms |
10892 KB |
Output is correct |
10 |
Correct |
94 ms |
10868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
296 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
300 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
296 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
300 KB |
Output is correct |
11 |
Correct |
1 ms |
304 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
300 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
284 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
296 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
300 KB |
Output is correct |
11 |
Correct |
1 ms |
304 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
300 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
284 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
21 |
Correct |
3 ms |
340 KB |
Output is correct |
22 |
Correct |
14 ms |
388 KB |
Output is correct |
23 |
Correct |
4 ms |
312 KB |
Output is correct |
24 |
Correct |
4 ms |
340 KB |
Output is correct |
25 |
Correct |
4 ms |
304 KB |
Output is correct |
26 |
Correct |
2 ms |
288 KB |
Output is correct |
27 |
Correct |
3 ms |
340 KB |
Output is correct |
28 |
Correct |
1 ms |
340 KB |
Output is correct |
29 |
Correct |
1 ms |
312 KB |
Output is correct |
30 |
Correct |
1 ms |
304 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1050 ms |
10672 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |