Submission #1094224

# Submission time Handle Problem Language Result Execution time Memory
1094224 2024-09-29T03:34:54 Z Trisanu_Das Feast (NOI19_feast) C++17
59 / 100
1000 ms 7772 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long

 
signed main(){
  ios_base::sync_with_stdio(false); cin.tie(0);
  int n, k; cin >> n >> k;
  int a[n], dp[2][k + 1], ans[2][k + 1]; for(int i = 0; i < n; i++) cin >> a[i];
  for(int i = 0; i < n; i++){
    for(int j = 1; j <= k; j++){
      dp[i & 1][j] = max(dp[(i + 1) & 1][j], ans[(i + 1) & 1][j - 1]) + a[i];
      ans[i & 1][j] = max(ans[(i + 1) & 1][j], dp[i & 1][j]);
    }
  }
  cout << ans[(n + 1) & 1][k] << '\n';
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1041 ms 5972 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 15 ms 3672 KB Output is correct
2 Correct 14 ms 3928 KB Output is correct
3 Correct 14 ms 3852 KB Output is correct
4 Execution timed out 1098 ms 7772 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 5724 KB Output is correct
2 Correct 25 ms 5456 KB Output is correct
3 Correct 25 ms 5680 KB Output is correct
4 Correct 23 ms 5724 KB Output is correct
5 Correct 24 ms 5712 KB Output is correct
6 Correct 25 ms 5700 KB Output is correct
7 Correct 24 ms 5724 KB Output is correct
8 Correct 24 ms 5556 KB Output is correct
9 Correct 29 ms 5704 KB Output is correct
10 Correct 25 ms 5704 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 456 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 456 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 600 KB Output is correct
22 Correct 5 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 360 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 500 KB Output is correct
28 Correct 1 ms 600 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1041 ms 5972 KB Time limit exceeded
2 Halted 0 ms 0 KB -